Пример #1
0
    def test_cert_based_auth_ca_no_cert(self, mock_delete_protected_repo):
        repo = Repository(repo_id='test')
        config = {'auth_ca': 'looks not so legit'}

        configuration.process_cert_based_auth(repo, config)

        mock_delete_protected_repo.assert_called_once_with(repo.repo_id)
Пример #2
0
    def test_cert_based_auth_ca_no_cert(self, mock_delete_protected_repo):
        repo = Repository(repo_id='test')
        config = {'auth_ca': 'looks not so legit'}

        configuration.process_cert_based_auth(repo, config)

        mock_delete_protected_repo.assert_called_once_with(repo.repo_id)
Пример #3
0
    def test_cert_based_auth_ca_and_cert(self, mock_write_consumer_cert_bundle, mock_add_protected_repo):
        repo = Repository(repo_id="test")
        config = {"auth_ca": "looks legit", "auth_cert": "1234567890"}
        bundle = {"ca": config["auth_ca"], "cert": config["auth_cert"]}

        configuration.process_cert_based_auth(repo, config)

        mock_write_consumer_cert_bundle.assert_called_once_with(repo.repo_id, bundle)
        mock_add_protected_repo.assert_called_once_with(repo.repo_id, repo.repo_id)
    def test_cert_based_auth_ca_and_cert(self, mock_write_consumer_cert_bundle, mock_add_protected_repo):
        repo = Repository('test')
        config = {'auth_ca': 'looks legit',
                  'auth_cert': '1234567890'}
        bundle = {'ca': config['auth_ca'], 'cert': config['auth_cert']}

        configuration.process_cert_based_auth(repo, config)

        mock_write_consumer_cert_bundle.assert_called_once_with(repo.id, bundle)
        mock_add_protected_repo.assert_called_once_with(repo.id, repo.id)
Пример #5
0
    def test_cert_based_auth_ca_and_cert(self, mock_write_consumer_cert_bundle,
                                         mock_add_protected_repo):
        repo = Repository('test')
        config = {'auth_ca': 'looks legit',
                  'auth_cert': '1234567890'}
        bundle = {'ca': config['auth_ca'], 'cert': config['auth_cert']}

        configuration.process_cert_based_auth(repo, config)

        mock_write_consumer_cert_bundle.assert_called_once_with(repo.id, bundle)
        mock_add_protected_repo.assert_called_once_with(repo.id, repo.id)
Пример #6
0
    def test_cert_based_auth_no_ca_no_cert(self, mock_delete_protected_repo):
        repo = Repository(repo_id='test')

        configuration.process_cert_based_auth(repo, {})

        mock_delete_protected_repo.assert_called_once_with(repo.repo_id)
Пример #7
0
    def test_cert_based_auth_no_ca_no_cert(self, mock_delete_protected_repo):
        repo = Repository(repo_id='test')

        configuration.process_cert_based_auth(repo, {})

        mock_delete_protected_repo.assert_called_once_with(repo.repo_id)