def _create(self, name='testcloud1', **kwargs): cloud = Cloud(name=name, endpoint=self.test_endpoint, user_name=self.test_user, tenant_name=self.test_tenant, password=self.test_password, **kwargs) cloud.save() return cloud
def test_get_random(self): self._create(name='cloud1') self._create(name='cloud2') self._create(name='cloud3') # There's a 0.03% chance this test will fail. I'm OK with those # odds. them_all = set([Cloud.get_random() for x in range(20)]) self.assertEqual(len(them_all), 3)