summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgecong1973 <ge.cong@zte.com.cn>2018-11-12 17:19:58 -0800
committergecong1973 <ge.cong@zte.com.cn>2018-11-12 17:19:58 -0800
commit320b357e4e57cda3da994363ac8ad54811265b0d (patch)
treeda663cc809eabd57b48c5cdf88ffb2be43ec4dcf
parent76bd75c371b391d886c1f8eea1d598e48d2cc725 (diff)
Add action delete unit test for sql
The patch add get and delete action unit test for sql Change-Id: Ia7e021b39fc25607153db7b6c0d2b5e7ea402b75
Notes
Notes (review): Code-Review+2: gengchc2 <geng.changcai2@zte.com.cn> Code-Review+2: Carl Caihui <cai.hui@zte.com.cn> Workflow+1: Carl Caihui <cai.hui@zte.com.cn> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 13 Nov 2018 03:57:26 +0000 Reviewed-on: https://review.openstack.org/617402 Project: openstack/freezer-api Branch: refs/heads/master
-rw-r--r--freezer_api/tests/unit/sqlalchemy/test_action.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/freezer_api/tests/unit/sqlalchemy/test_action.py b/freezer_api/tests/unit/sqlalchemy/test_action.py
index 2ca71d4..8af4897 100644
--- a/freezer_api/tests/unit/sqlalchemy/test_action.py
+++ b/freezer_api/tests/unit/sqlalchemy/test_action.py
@@ -65,3 +65,27 @@ class DbActionTestCase(base.DbTestCase):
65 65
66 self.assertEqual(freezer_action.get('mode'), 66 self.assertEqual(freezer_action.get('mode'),
67 self.freezer_action_0.get('mode')) 67 self.freezer_action_0.get('mode'))
68
69 def test_add_and_delete_action(self):
70 action_doc = copy.deepcopy(self.fake_action_0)
71 action_id = self.dbapi.add_action(user_id=self.fake_action_0.
72 get('user_id'),
73 doc=action_doc,
74 project_id="myproject")
75 self.assertIsNotNone(action_id)
76
77 result = self.dbapi.delete_action(project_id="myproject",
78 user_id=self.fake_action_0.
79 get('user_id'),
80 action_id=action_id)
81
82 self.assertIsNotNone(result)
83
84 self.assertEqual(result, action_id)
85
86 result = self.dbapi.get_action(project_id="myproject",
87 user_id=self.fake_action_0.
88 get('user_id'),
89 action_id=action_id)
90
91 self.assertEqual(len(result), 0)