def test_add_again(self): """Adding project again should have no effect.""" rel = factories.ProjectRelationship(project=self.project, user=self.user) response = self._post(data=self._data()) self.assertEquals(response.status_code, 302) rel = ProjectRelationship.objects.get() self.assertEquals(rel.project, self.project) self.assertEquals(rel.user, self.user)
def test_clock_in_form_activity_lookup(self): """Create an ActivityGroup that includes the Activity, and associate it with the project. Add a second Activity that is not included. Ensure that the ActivityLookup disallows the second Activity. """ factory = RequestFactory() lookup = ActivityLookup() factories.Activity() activity_group = factories.ActivityGroup() activity_group.activities.add(self.activity) project2 = factories.Project(activity_group=activity_group) factories.ProjectRelationship(project=project2, user=self.user) request = factory.get("/entry/clock_in/", {'project': project2.pk}) response = lookup.results(request) data = json.loads(response.content.decode("utf-8"))['data'] self.assertEqual(1, len(data)) self.assertEqual(self.activity.pk, data[0]['id'])
def setUp(self): super(TestDeleteRelationship, self).setUp() self.relationship = factories.ProjectRelationship( project=self.project, user=self.user)
def setUp(self): super(TestEditRelationship, self).setUp() self.relationship = factories.ProjectRelationship( project=self.project, user=self.user) self.rel_type1 = factories.RelationshipType() self.rel_type2 = factories.RelationshipType()