コード例 #1
0
 def test_get(self):
     """
     Attempt to fetch a GroupAction document
     """
     group_action1 = Database.create_group_action()
     group_action2 = Database.get_group_action(group_action1.group_action_id)
     self.assertEqual(group_action1.group_action_id, group_action2.group_action_id)
コード例 #2
0
 def test_cancel(self):
     """
     This test will pass if an action is successfully cancelled.
     """
     group_action = Database.create_group_action()
     self.assertEqual(group_action.cancelled, False)
     data = APIClient.cancel_group_action(self.client,
                                          group_action.group_action_id)
     self.assertEqual(data['error'], False)
     group_action = Database.get_group_action(group_action.group_action_id)
     self.assertEqual(group_action.cancelled, True)
     self.assertEqual(group_action.get_status(),
                      GROUP_ACTION_STATUSES.get('cancelled', 'cancelled'))
     for action in group_action.actions:
         self.assertEqual(action.cancelled, True)
         self.assertEqual(action.status,
                          ACTION_STATUSES.get('cancelled', 'cancelled'))
コード例 #3
0
 def test_create(self):
     """
     This test will pass if the group action is created and content matches.
     """
     targets = [
         Database.create_target().name,
         Database.create_target().name,
         Database.create_target().name,
         Database.create_target().name,
     ]
     group = Database.create_group('TEST', targets)
     data = APIClient.create_group_action(self.client, group.name,
                                          'exec echo hello | wall')
     self.assertEqual(data['error'], False)
     group_action = Database.get_group_action(data['group_action_id'])
     self.assertIsNotNone(group_action)
     self.assertEqual(group_action.action_string, 'exec echo hello | wall')
     for action in group_action.actions:
         self.assertEqual(action.action_string, 'exec echo hello | wall')