Beispiel #1
0
    def test_event_get_all(self):
        self.stack1 = create_stack(self.ctx,
                                   self.template,
                                   self.user_creds,
                                   tenant='tenant1')
        self.stack2 = create_stack(self.ctx,
                                   self.template,
                                   self.user_creds,
                                   tenant='tenant2')
        values = [
            {
                'stack_id': self.stack1.id,
                'resource_name': 'res1'
            },
            {
                'stack_id': self.stack1.id,
                'resource_name': 'res2'
            },
            {
                'stack_id': self.stack2.id,
                'resource_name': 'res3'
            },
        ]
        [create_event(self.ctx, **val) for val in values]

        events = db_api.event_get_all(self.ctx)
        self.assertEqual(3, len(events))

        stack_ids = [event.stack_id for event in events]
        res_names = [event.resource_name for event in events]
        [(self.assertIn(val['stack_id'], stack_ids),
          self.assertIn(val['resource_name'], res_names)) for val in values]
Beispiel #2
0
    def test_event_get_all(self):
        stacks = [self._setup_test_stack('stack', x)[1] for x in UUIDs]

        self._mock_create(self.m)
        self.m.ReplayAll()
        [s.create() for s in stacks]
        self.m.UnsetStubs()

        events = db_api.event_get_all(self.ctx)
        self.assertEqual(6, len(events))

        self._mock_delete(self.m)
        self.m.ReplayAll()
        stacks[0].delete()

        events = db_api.event_get_all(self.ctx)
        self.assertEqual(4, len(events))

        self.m.VerifyAll()
Beispiel #3
0
    def test_event_get_all(self):
        stacks = [self._setup_test_stack('stack', x)[1] for x in UUIDs]

        self._mock_create(self.m)
        self.m.ReplayAll()
        [s.create() for s in stacks]
        self.m.UnsetStubs()

        events = db_api.event_get_all(self.ctx)
        self.assertEqual(4, len(events))

        self._mock_delete(self.m)
        self.m.ReplayAll()
        stacks[0].delete()

        events = db_api.event_get_all(self.ctx)
        self.assertEqual(2, len(events))

        self.m.VerifyAll()
Beispiel #4
0
    def test_event_get_all(self):
        self.stack1 = create_stack(self.ctx, self.template, self.user_creds,
                                   tenant='tenant1')
        self.stack2 = create_stack(self.ctx, self.template, self.user_creds,
                                   tenant='tenant2')
        values = [
            {'stack_id': self.stack1.id, 'resource_name': 'res1'},
            {'stack_id': self.stack1.id, 'resource_name': 'res2'},
            {'stack_id': self.stack2.id, 'resource_name': 'res3'},
        ]
        [create_event(self.ctx, **val) for val in values]

        events = db_api.event_get_all(self.ctx)
        self.assertEqual(3, len(events))

        stack_ids = [event.stack_id for event in events]
        res_names = [event.resource_name for event in events]
        [(self.assertIn(val['stack_id'], stack_ids),
          self.assertIn(val['resource_name'], res_names)) for val in values]
Beispiel #5
0
 def get_all(cls, context):
     return [cls._from_db_object(context, cls(), db_event)
             for db_event in db_api.event_get_all(context)]
Beispiel #6
0
 def get_all(cls, context):
     return [
         cls._from_db_object(context, cls(), db_event)
         for db_event in db_api.event_get_all(context)
     ]