Example #1
0
    def test_pypi_test_url(self):
        input = {'source': {'test': True}}
        input = common.merge_defaults(input)
        self.assertEqual(pipio.get_pypi_url(input),
                         ('https://test.pypi.org/legacy/', 'test.pypi.org'))

        input = {'source': {'test': False}}
        input = common.merge_defaults(input)
        self.assertEqual(
            pipio.get_pypi_url(input),
            ('https://upload.pypi.org/legacy/', 'upload.pypi.org'))
Example #2
0
    def test_pypi_test_url(self):
        input = {'source': {'test': True}}
        input = common.merge_defaults(input)
        self.assertEqual(
            pipio.get_pypi_url(input),
            ('https://testpypi.python.org/pypi', 'testpypi.python.org'))

        input = {'source': {'test': False}}
        input = common.merge_defaults(input)
        self.assertEqual(pipio.get_pypi_url(input),
                         ('https://pypi.python.org/pypi', 'pypi.python.org'))
Example #3
0
    def test_pypi_url(self):
        input = {'source': {'repository_url': 'http://example.org/pypi'}}
        input = common.merge_defaults(input)
        self.assertEqual(pipio.get_pypi_url(input),
                         ('http://example.org/pypi', 'example.org'))

        input = {
            'source': {
                'repository': {
                    'repository_url': 'http://example.org/pypi'
                }
            }
        }
        input = common.merge_defaults(input)
        self.assertEqual(pipio.get_pypi_url(input),
                         ('http://example.org/pypi', 'example.org'))

        input = {
            'source': {
                'repository': {
                    'authenticate': 'always',
                    'username': '******',
                    'password': '******'
                }
            }
        }
        input = common.merge_defaults(input)
        self.assertEqual(
            pipio.get_pypi_url(input, 'in'),
            ('https://*****:*****@upload.pypi.org/legacy/', 'upload.pypi.org'))

        input = {'source': {'repository': {'username': '******', 'password': '******'}}}
        input = common.merge_defaults(input)
        self.assertEqual(
            pipio.get_pypi_url(input, 'in'),
            ('https://upload.pypi.org/legacy/', 'upload.pypi.org'))
        self.assertEqual(
            pipio.get_pypi_url(input, 'out'),
            ('https://*****:*****@upload.pypi.org/legacy/', 'upload.pypi.org'))

        input = {
            'source': {
                'repository': {
                    'username':
                    '******',
                    'password':
                    '******',
                    'authenticate':
                    'always',
                    'repository_url':
                    'http://*****:*****@localhost:8081/repository/pypi-private/',
             'localhost'))