Skip to content

Commit

Permalink
Add indirect test case for match and execute client bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kami committed Feb 8, 2021
1 parent e2e624e commit 5df4e8e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions st2api/tests/unit/controllers/v1/test_action_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
FIXTURES_PACK = 'aliases'

TEST_MODELS = {
'aliases': ['alias1.yaml', 'alias2.yaml', 'alias_with_undefined_jinja_in_ack_format.yaml']
'aliases': ['alias1.yaml', 'alias2.yaml', 'alias_with_undefined_jinja_in_ack_format.yaml'],
'actions': ['action1.yaml'],
}

TEST_LOAD_MODELS = {
Expand All @@ -34,7 +35,8 @@
GENERIC_FIXTURES_PACK = 'generic'

TEST_LOAD_MODELS_GENERIC = {
'aliases': ['alias3.yaml']
'aliases': ['alias3.yaml'],
'runners': ['testrunner1.yaml']
}


Expand Down Expand Up @@ -180,6 +182,18 @@ def test_match(self):
self.assertEqual(resp.json['actionalias']['name'],
'alias_with_undefined_jinja_in_ack_format')

def test_match_and_execute_success(self):
data = {
'command': 'run whoami on localhost1',
'source_channel': 'hubot',
'user': "user",
}
resp = self.app.post_json("/v1/aliasexecution/match_and_execute", data)
self.assertEqual(resp.status_int, 201)
self.assertEqual(len(resp.json["results"]), 1)
self.assertTrue(resp.json["results"][0]["actionalias"]["ref"],
"aliases.alias_with_undefined_jinja_in_ack_format")

def test_help(self):
resp = self.app.get("/v1/actionalias/help")
self.assertEqual(resp.status_int, 200)
Expand Down

0 comments on commit 5df4e8e

Please sign in to comment.