def test_app_configure(self, dependabot_repo, get_github_repo, install_app_on_repo): # given repo_name = 'mock-repo-name' config = [{ 'teams': { 'team-c': 'pull' }, 'apps': { 'dependabot': True }, 'repos': [repo_name] }] mock_repo = Mock() mock_repo.name = repo_name mock_repo.archived = False mock_repo.admin = True get_github_repo.return_value = mock_repo # when app = App(ANY, ANY, self._app_id, ANY, ANY, Mock()) app.configure(config) # then app.install_app_on_repo.assert_called_once_with( self._app_id, mock_repo)
def test_app_configure_no_repos(self, enforce_app_access): # given config = [{'teams': {'team-c': 'pull'}, 'apps': {'dependabot': True}}] # when app = App(ANY, ANY, self._app_id, ANY, ANY, Mock()) app.configure(config) # then app.enforce_app_access.assert_not_called()
def test_app_configure_no_app(self, cease_app_access, enforce_app_access): # given config = [{'teams': {'team-c': 'pull'}, 'repos': ['mock_repo_name']}] # when app = App(ANY, ANY, self._app_id, ANY, ANY, Mock()) app.configure(config) # then app.cease_app_access.assert_called_with('mock_repo_name') app.enforce_app_access.assert_not_called()