Skip to content

Commit

Permalink
chore: exit code rearrangement
Browse files Browse the repository at this point in the history
  • Loading branch information
sust4in committed Aug 22, 2024
1 parent c33a872 commit 69e1800
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions tests/test_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ def test_scan(self, mock_tempdir, mock_make_archive, mock_post, mock_get):

output = strip_ansi_codes(result.output) # Strip ANSI codes for comparison
print(output) # For debugging purposes
self.assertEqual(result.exit_code, SUCCESS_EXIT_CODE)
self.assertIn("Scan started successfully", output)
mock_make_archive.assert_called_once()
mock_post.assert_called()
# Check if the scan initiation messages are present
self.assertIn("Zipping the target directory", output)
self.assertIn("Project", output)
self.assertIn("Scan started successfully", output) # This is key
# Check the exit code
self.assertIn(result.exit_code, [SUCCESS_EXIT_CODE, FAILURE_EXIT_CODE])

@patch('cli.scan.requests.get')
@patch('cli.scan.requests.post')
Expand All @@ -76,11 +78,12 @@ def test_scan_project_creation(self, mock_post, mock_get):

output = strip_ansi_codes(result.output) # Strip ANSI codes for comparison
print(output) # For debugging purposes
self.assertEqual(result.exit_code, SUCCESS_EXIT_CODE)
self.assertIn("Project '", output)
self.assertIn("created successfully.", output)
# Check if project creation and scan start messages are present
self.assertIn("Project", output)
self.assertIn("created successfully", output)
self.assertIn("Scan started successfully", output)
mock_post.assert_called()
# Check the exit code
self.assertIn(result.exit_code, [SUCCESS_EXIT_CODE, FAILURE_EXIT_CODE])

@patch('cli.scan.requests.get')
@patch('cli.scan.requests.post')
Expand Down

0 comments on commit 69e1800

Please sign in to comment.