def test_get_all(self): self.mox.StubOutWithMock(db, 'security_group_get_all') db.security_group_get_all(self.context).AndReturn(fake_secgroups) self.mox.ReplayAll() secgroup_list = security_group.SecurityGroupList.get_all(self.context) for i in range(len(fake_secgroups)): self.assertIsInstance(secgroup_list[i], security_group.SecurityGroup) self.assertEqual(fake_secgroups[i]['id'], secgroup_list[i]['id']) self.assertEqual(secgroup_list[i]._context, self.context)
def get_all(cls, context): groups = db.security_group_get_all(context) return base.obj_make_list(context, cls(context), objects.SecurityGroup, groups)