Skip to content

Commit

Permalink
Update test with a node that has chart_attribute or not
Browse files Browse the repository at this point in the history
  • Loading branch information
JokeWaumans committed Aug 22, 2024
1 parent 3364edd commit 89ae364
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/test_coverity.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ def test_get_defects(self, filters, column_names, request_data):

def test_get_filtered_defects(self):
"""Test `get_filtered_defects` of SphinxCoverityConnector. Check if `get_defects` is called once with the
correct arguments."""
correct arguments.
Tests also when `chart_attribute` of the node exists, the name will be added to column_names."""
sphinx_coverity_connector = SphinxCoverityConnector()
sphinx_coverity_connector.coverity_service = self.initialize_coverity_service(login=False)
sphinx_coverity_connector.stream = self.fake_stream
Expand All @@ -184,11 +185,13 @@ def test_get_filtered_defects(self):
fake_node = CoverityDefect()
fake_node["col"] = column_names
fake_node["filters"] = node_filters
fake_node["chart_attribute"] = "Checker"
with patch.object(CoverityDefectService, "get_defects") as mock_method:
sphinx_coverity_connector.get_filtered_defects(fake_node)
column_names.add("Checker")
mock_method.assert_called_once_with(self.fake_stream, fake_node["filters"], column_names)
fake_node["chart_attribute"] = "Checker"
column_names.add("Checker")
sphinx_coverity_connector.get_filtered_defects(fake_node)
mock_method.assert_called_with(self.fake_stream, fake_node["filters"], column_names)

def test_failed_login(self):
"""Test a failed login by mocking the status code when validating the stream."""
Expand Down

0 comments on commit 89ae364

Please sign in to comment.