Add indirect test case for match and execute client bug.
@@ -24,7 +24,8 @@ from st2tests.api import APIControllerWithIncludeAndExcludeFilterTestCase
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 = {
@@ -34,7 +35,8 @@ TEST_LOAD_MODELS = {
GENERIC_FIXTURES_PACK = 'generic'
TEST_LOAD_MODELS_GENERIC = {
- 'aliases': ['alias3.yaml']
+ 'aliases': ['alias3.yaml'],
+ 'runners': ['testrunner1.yaml']
}
@@ -180,6 +182,18 @@ class ActionAliasControllerTestCase(FunctionalTest,
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)
