Add action delete unit test for sql
The patch add get and delete action unit test for sql Change-Id: Ia7e021b39fc25607153db7b6c0d2b5e7ea402b75
This commit is contained in:
parent
76bd75c371
commit
320b357e4e
|
@ -65,3 +65,27 @@ class DbActionTestCase(base.DbTestCase):
|
|||
|
||||
self.assertEqual(freezer_action.get('mode'),
|
||||
self.freezer_action_0.get('mode'))
|
||||
|
||||
def test_add_and_delete_action(self):
|
||||
action_doc = copy.deepcopy(self.fake_action_0)
|
||||
action_id = self.dbapi.add_action(user_id=self.fake_action_0.
|
||||
get('user_id'),
|
||||
doc=action_doc,
|
||||
project_id="myproject")
|
||||
self.assertIsNotNone(action_id)
|
||||
|
||||
result = self.dbapi.delete_action(project_id="myproject",
|
||||
user_id=self.fake_action_0.
|
||||
get('user_id'),
|
||||
action_id=action_id)
|
||||
|
||||
self.assertIsNotNone(result)
|
||||
|
||||
self.assertEqual(result, action_id)
|
||||
|
||||
result = self.dbapi.get_action(project_id="myproject",
|
||||
user_id=self.fake_action_0.
|
||||
get('user_id'),
|
||||
action_id=action_id)
|
||||
|
||||
self.assertEqual(len(result), 0)
|
||||
|
|
Loading…
Reference in New Issue