Add a test case which verifies metadata_file attribute is also set when
registering resources via the API.
@@ -21,6 +21,7 @@ import mock
from st2common.content.loader import ContentPackLoader
from st2common.models.db.pack import PackDB
from st2common.persistence.pack import Pack
+from st2common.persistence.action import Action
from st2common.router import Response
from st2common.services import packs as pack_service
from st2api.controllers.v1.actionexecutions import ActionExecutionsControllerMixin
@@ -462,6 +463,10 @@ class PacksControllerTestCase(FunctionalTest,
self.assertTrue(resp.json['sensors'] >= 1)
self.assertTrue(resp.json['configs'] >= 1)
+ # Verify metadata_file attribute is set
+ action_dbs = Action.query(pack='dummy_pack_1')
+ self.assertEqual(action_dbs[0].metadata_file, 'actions/my_action.yaml')
+
# Register 'all' resource types should try include any possible content for the pack
resp = self.app.post_json('/v1/packs/register', {'packs': ['dummy_pack_1'],
'fail_on_failure': False,
