Ejemplo n.º 1
0
    def test__get_relative_path(self):
        repo = MagicMock()
        repo.repo_id = 'awesome_repo'

        relative_path = publish._get_relative_path(repo)

        self.assertEqual(relative_path, repo.repo_id)
    def test__get_relative_path(self):
        repo = MagicMock()
        repo.id = 'awesome_repo'

        relative_path = publish._get_relative_path(repo)

        self.assertEqual(relative_path, repo.id)
    def test__remove_repository_protection(self, delete_protected_repo):
        repo = MagicMock()
        repo.id = 'reporeporeporepo'

        publish.remove_repository_protection(repo)

        delete_protected_repo.assert_called_once_with(publish._get_relative_path(repo))
Ejemplo n.º 4
0
    def test__remove_repository_protection(self, delete_protected_repo):
        repo = MagicMock()
        repo.id = 'reporeporeporepo'

        publish.remove_repository_protection(repo)

        delete_protected_repo.assert_called_once_with(
            publish._get_relative_path(repo))
    def test__configure_repository_protection(self, write_consumer_cert_bundle, add_protected_repo):
        repo = MagicMock()
        repo.id = 7
        cert = 'This is a real cert, trust me.'

        publish.configure_repository_protection(repo, cert)

        # Assert that the appropriate repository protection calls were made
        write_consumer_cert_bundle.assert_called_once_with(repo.id, {'ca': cert})
        add_protected_repo.assert_called_once_with(publish._get_relative_path(repo), repo.id)
Ejemplo n.º 6
0
    def test__configure_repository_protection(self, write_consumer_cert_bundle,
                                              add_protected_repo):
        repo = MagicMock()
        repo.id = 7
        cert = 'This is a real cert, trust me.'

        publish.configure_repository_protection(repo, cert)

        # Assert that the appropriate repository protection calls were made
        write_consumer_cert_bundle.assert_called_once_with(
            repo.id, {'ca': cert})
        add_protected_repo.assert_called_once_with(
            publish._get_relative_path(repo), repo.id)