MCPcopy Create free account
hub / github.com/StackStorm/st2 / delete_models_from_db

Method delete_models_from_db

st2tests/st2tests/fixturesloader.py:379–403  ·  view source on GitHub ↗

Deletes models specified in models_dict from the database. models_dict should be of the form: { 'actions': [ACTION1, ACTION2], 'rules': [RULE1], 'liveactions': [EXECUTION] } :param fixtures_dict: Dictionary specifying the

(self, models_dict, raise_on_fail=False)

Source from the content-addressed store, hash-verified

377 raise
378
379 def delete_models_from_db(self, models_dict, raise_on_fail=False):
380 """
381 Deletes models specified in models_dict from the database.
382
383 models_dict should be of the form:
384 {
385 'actions': [ACTION1, ACTION2],
386 'rules': [RULE1],
387 'liveactions': [EXECUTION]
388 }
389
390 :param fixtures_dict: Dictionary specifying the fixtures to delete for each type.
391 :type fixtures_dict: ``dict``.
392
393 :param raise_on_fail: Optional If True, raises exception if delete fails on any model.
394 :type raise_on_fail: ``boolean``
395 """
396 for model_type, models in six.iteritems(models_dict):
397 PERSISTENCE_MODEL = FIXTURE_PERSISTENCE_MODEL.get(model_type, None)
398 for model in models:
399 try:
400 PERSISTENCE_MODEL.delete(model)
401 except:
402 if raise_on_fail:
403 raise
404
405 def _validate_fixtures_pack(self, fixtures_pack):
406 fixtures_pack_path = self._get_fixtures_pack_path(fixtures_pack)

Callers 1

tearDownClassMethod · 0.80

Calls 2

getMethod · 0.45
deleteMethod · 0.45

Tested by 1

tearDownClassMethod · 0.64