Skip to content

Commit

Permalink
BUG: fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anish-mudaraddi committed May 13, 2024
1 parent 9830275 commit 60b2f29
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 47 deletions.
2 changes: 1 addition & 1 deletion actions/src/quota_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, *args, config: Dict = None, **kwargs):
self._api: OpenstackQuota = config.get("openstack_api", OpenstackQuota())

# lists possible functions that could be run as an action
self.func = {"quota_set": self.quota_set, "quota_show": self.quota_show}
self.func = {"quota_set": self.quota_set}

def run(self, submodule: str, **kwargs):
"""
Expand Down
46 changes: 0 additions & 46 deletions tests/actions/test_security_group_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,52 +27,6 @@ def setUp(self):
api_mocks=self.security_group_mock
)

def test_find_security_group_successful(self):
"""
Tests find security group forwards the result and status if successful
"""
cloud, project, group = NonCallableMock(), NonCallableMock(), NonCallableMock()
returned = self.action.security_group_find(cloud, project, group)
expected = self.security_group_mock.find_security_group.return_value

self.security_group_mock.find_security_group.assert_called_with(
cloud, project, group
)
assert returned == (True, expected)

def test_find_security_group_failed(self):
"""
Tests method returns status and error string on failure
"""
self.security_group_mock.find_security_group.return_value = None
returned = self.action.security_group_find(
NonCallableMock(), NonCallableMock(), NonCallableMock()
)
assert returned[0] is False
assert "could not be found" in returned[1]

def test_search_security_groups_successful(self):
"""
Tests search security group forwards the result and status if successful
"""
cloud, project = NonCallableMock(), NonCallableMock()
returned = self.action.security_group_list(cloud, project)

self.security_group_mock.search_security_group.assert_called_with(
cloud, project
)
expected = self.security_group_mock.search_security_group.return_value
assert returned == (True, expected)

def test_search_security_groups_failed(self):
"""
Tests method returns status and empty list on failure
"""
self.security_group_mock.search_security_group.return_value = []
returned = self.action.security_group_list(NonCallableMock(), NonCallableMock())

assert returned == (False, [])

def test_create_security_group_success(self):
"""
Tests create security group forwards the new security group if successful
Expand Down

0 comments on commit 60b2f29

Please sign in to comment.