def test_register_all_actions(self): try: packs_base_path = os.path.join(tests_base.get_fixtures_path()) all_actions_in_db = Action.get_all() actions_registrar.register_actions(packs_base_path=packs_base_path) all_actions_in_db = Action.get_all() self.assertTrue(len(all_actions_in_db) > 0) except Exception as e: print(str(e)) self.fail('All actions must be registered without exceptions.')
def test_register_all_actions(self): try: packs_base_path = fixtures_loader.get_fixtures_base_path() all_actions_in_db = Action.get_all() actions_registrar.register_actions(packs_base_paths=[packs_base_path]) except Exception as e: print(str(e)) self.fail('All actions must be registered without exceptions.') else: all_actions_in_db = Action.get_all() self.assertTrue(len(all_actions_in_db) > 0)
def test_register_all_actions(self): try: packs_base_path = fixtures_loader.get_fixtures_base_path() all_actions_in_db = Action.get_all() actions_registrar.register_actions(packs_base_paths=[packs_base_path]) except Exception as e: print(six.text_type(e)) self.fail("All actions must be registered without exceptions.") else: all_actions_in_db = Action.get_all() self.assertTrue(len(all_actions_in_db) > 0) # Assert metadata_file field is populated expected_path = "actions/action-with-no-parameters.yaml" self.assertEqual(all_actions_in_db[0].metadata_file, expected_path)
def test_register_all_actions(self): try: packs_base_path = fixtures_loader.get_fixtures_base_path() all_actions_in_db = Action.get_all() actions_registrar.register_actions(packs_base_paths=[packs_base_path]) except Exception as e: print(six.text_type(e)) self.fail('All actions must be registered without exceptions.') else: all_actions_in_db = Action.get_all() self.assertTrue(len(all_actions_in_db) > 0) # Assert metadata_file field is populated expected_path = 'actions/action-with-no-parameters.yaml' self.assertEqual(all_actions_in_db[0].metadata_file, expected_path)
def get_all(self, **kwargs): """ List all actions. Handles requests: GET /actions/views/overview """ LOG.info('GET all /actions/views/overview with filters=%s', kwargs) kwargs = self._get_filters(**kwargs) action_dbs = Action.get_all(**kwargs) action_apis = [ActionAPI.from_model(action_db) for action_db in action_dbs] return map(self._transform_action_api, action_apis)
def get_all(self, **kwargs): """ List all actions. Handles requests: GET /actions/views/overview """ LOG.info('GET all /actions/views/overview with filters=%s', kwargs) kwargs = self._get_filters(**kwargs) action_dbs = Action.get_all(**kwargs) action_apis = [ ActionAPI.from_model(action_db) for action_db in action_dbs ] return map(self._transform_action_api, action_apis)