pypi / tests /

import distutils2

from distutils2.metadata import DistributionMetadata

import os
import unittest
import config
import pkg_resources
import cStringIO

import store
import trove

DATA_DIR = os.path.join(os.path.dirname(trove.__file__), "tests", "data")
CONFIG_FILE = os.path.join(DATA_DIR, "config.ini")
DUMP = os.path.join(DATA_DIR, "test_dump.sql")
DUMP_DATA = os.path.join(DATA_DIR, "test_dump-data.sql")

user1 = ("user1", "pass", "", None)
user2 = ("user2", "pass", "", None)
user3 = ("user3", "pass", "", None)

class TestStore ( unittest.TestCase ):

    def setUp(self): = store.Store( config.Config( CONFIG_FILE ) )"".join(open(DUMP).readlines()))

    def tearDown(self):

    def test_store_package(self):
        PKG_INFO = os.path.join(DATA_DIR, 'PKG-INFO')
        metadata = DistributionMetadata(PKG_INFO)
        metadata = dict(metadata.items())
        packages ="pypi", "0.1")

        self.assertRaises(TypeError, packages.values)"pypi", "0.1", metadata)

        packages ="pypi", "0.1")    
        assert len(packages.values()) == 21

        packages ="pypi", "0.2")
        self.assertRaises(TypeError, packages.values) 

        package ="pypi", "0.1", metadata)
        assert package is None

        metadata['author'] = 'Foo'
        package ="pypi", "0.1", metadata)

        assert package is not None

    def test_create_user(self):       *user1)

        assert"user1") is not None
        self.assertRaises(ValueError,, *user2)

    def test_get_users(self):*user1)*user3)

    def test_get_user(self):*user1)
        self.assertTrue('user1' in"user1").values())

    def test_get_user_by_email(self):*user1)
        self.assertTrue('user1' in"").values())

    def test_sshkeys(self):*user1)
        assert len('user1')) == 0'user1', "sfasfaf")
        assert len('user1')) == 1'user1')[0].values()[0])
        assert len('user1')) == 0

    def test_get_openid(self):*user1)
        assert len('user1')) == 0'user1', 'openid_user1')
        assert len('user1')) == 1

    def test_get_user_by_openid(self):*user1)
        assert 'user1' not in'openid_user1')'user1', 'openid_user1')
        assert 'user1' in'openid_user1')'openid_user1')
        assert 'user1' not in'openid_user1')
#     def test_openid_provider(self):
#         self.assertTrue(False)

#     def test_role(self):
#         self.asserTrue(False)

#     def test_oth(self):
#         self.assertTrue(False)

#     def test_user_package(self):
#         self.asserTrue(False)
#     def test_user_package_details(self):
#         self.assertTrue(False)

#     def test_trows(self):
#         self.assertTrue(False)

#     def test_tally(self):
#         self.assertTrue(False)

#     def test_browse(self):
#         self.assertTrue(False)

#     def test_file_handling(self):
#         self.assertTrue(False)

#     def test_logging(self):
#         self.assertTrue(False)
#     def test_upload_times(self):
#         self.assertTrue(False)

#     def test_mirror(self):
#         self.assertTrue(False)

#     def test_cookie(self):
#         self.assertTrue(False)

#     def test_session(self):
#         self.assertTrue(False)

#     def test_nonce(self):
#         self.assertTrue(False)

if __name__ == '__main__':
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.