Skip to content

Commit

Permalink
chore: split tests into affirmative and negative
Browse files Browse the repository at this point in the history
Signed-off-by: Zack Koppert <[email protected]>
  • Loading branch information
zkoppert committed May 31, 2024
1 parent aa10db6 commit 9c10b13
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test_dependabot_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def test_build_dependabot_file_with_docker(self):
result = build_dependabot_file(repo, False, [], None)
self.assertEqual(result, expected_result)

def test_build_dependabot_file_with_terraform(self):
def test_build_dependabot_file_with_terraform_with_files(self):
"""Test that the dependabot.yml file is built correctly with Terraform"""
repo = MagicMock()
response = MagicMock()
Expand All @@ -272,6 +272,13 @@ def test_build_dependabot_file_with_terraform(self):
result = build_dependabot_file(repo, False, [], None)
self.assertEqual(result, expected_result)

def test_build_dependabot_file_with_terraform_without_files(self):
"""Test that the dependabot.yml file is built correctly with Terraform"""
repo = MagicMock()
response = MagicMock()
response.status_code = 404
repo.file_contents.side_effect = github3.exceptions.NotFoundError(resp=response)

# Test absence of Terraform files
repo.directory_contents.side_effect = lambda path: [] if path == "/" else []
result = build_dependabot_file(repo, False, [], None)
Expand Down

0 comments on commit 9c10b13

Please sign in to comment.