def test_with_duplicate_clients(self): self.client = ClientFactory() self.client2 = ClientFactory() self.client2.email = self.client.email self.client2.save() r = self.c.post( self.url, dict( pid=self.project.pid, task="test", time="1 hour", client="testclient", )) self.assertEqual(r.status_code, 200)
def test_copy_clients_to_new_item(self): i = ItemFactory() c = ClientFactory() i.add_clients([c]) i2 = ItemFactory() i.copy_clients_to_new_item(i2) self.assertTrue(c in [ic.client for ic in i2.itemclient_set.all()])
def test_post_with_client(self): self.client = ClientFactory() r = self.c.post( self.url, dict( pid=self.project.pid, task="test", time="1 hour", client="testclient", )) self.assertEqual(r.status_code, 200)
def test_active(self): c = ClientFactory(status='active') self.assertTrue(c.active()) c = ClientFactory(status='inactive') self.assertFalse(c.active())
def test_add_clients(self): i = ItemFactory() c = ClientFactory() i.add_clients([c]) self.assertTrue(c in [ic.client for ic in i.itemclient_set.all()])