def test_bug_list_show_inactive(self): """Test the bug list for a request showing inactive bugs""" utils.sample_bug(creator=self.member, project=self.project, title="Bug c") utils.sample_bug(creator=self.member, project=self.project, title="Bug a") utils.sample_bug(creator=self.member, project=self.project, title="Bug d", _status="FIXED") utils.sample_bug(creator=self.member, project=self.project, title="Bug b", _status="CLOSED") queryset = Bug.objects.all().order_by('-creationDate') res = self.client.get(self.list_url + '?show_inactive=1') self.assertEqual(res.status_code, 200) self.assertTemplateUsed(res, 'bugs/list.html') self.assertQuerysetEqual( res.context['bugs'], [repr(bug) for bug in queryset], )
def test_bug_detail_messages(self): """Test the bug messages are correctly passed to context""" self.client.force_login(self.member) other_bug = utils.sample_bug(creator=self.supervisor, project=self.project) Message.objects.create(content="Mess 5", bug=self.bug, writer=self.member) Message.objects.create(content="Mess 2", bug=self.bug, writer=self.member) Message.objects.create(content="Mess 1", bug=self.bug, writer=self.superuser) Message.objects.create(content="Mess 4", bug=self.bug, writer=self.supervisor) Message.objects.create(content="Mess 14", bug=other_bug, writer=self.member) Message.objects.create(content="Mess 13", bug=other_bug, writer=self.member) messages = Message.objects\ .filter(bug=self.bug).order_by('-creationDate') res = self.client.get(self.detail_url) self.assertEqual(res.status_code, 200) self.assertEqual(list(res.context['messages']), list(messages))
def setUp(self): self.creator = utils.sample_member() self.project = utils.sample_project() self.project.members.add(self.creator) self.bug = utils.sample_bug(creator=self.creator, project=self.project) self.client = Client() self.client.force_login(self.creator) self.update_url = reverse('bugs:creator_update', args=[self.bug.id])
def test_bug_list_basic(self): """Test the bug list for a basic request""" b1 = utils.sample_bug(creator=self.member, project=self.project, title="Bug c") b2 = utils.sample_bug(creator=self.member, project=self.project, title="Bug a") utils.sample_bug(creator=self.member, project=self.project, title="Bug d", _status="FIXED") utils.sample_bug(creator=self.member, project=self.project, title="Bug b", _status="CLOSED") res = self.client.get(self.list_url) queryset = Bug.objects.filter(id__in=[b1.id, b2.id]) self.assertEqual(res.status_code, 200) self.assertTemplateUsed(res, 'bugs/list.html') self.assertQuerysetEqual( res.context['bugs'], [repr(bug) for bug in queryset.order_by('-creationDate')])
def setUp(self): self.supervisor = utils.sample_member(email='*****@*****.**') self.project = utils.sample_project() self.project.members.add(self.supervisor) self.project.supervisors.add(self.supervisor) self.bug = utils.sample_bug(creator=self.supervisor, project=self.project) self.bug.set_status(self.bug.WAITING_STATUS) self.client = Client() self.client.force_login(self.supervisor) self.change_working_status_url = reverse('bugs:change_working_status', args=[self.bug.id])
def setUp(self): self.member = utils.sample_member(email='*****@*****.**') self.supervisor = utils.sample_member(email='*****@*****.**') self.project = utils.sample_project() self.project.members.add(self.member) self.project.members.add(self.supervisor) self.project.supervisors.add(self.supervisor) self.bug = utils.sample_bug(creator=self.member, project=self.project) self.client = Client() self.client.force_login(self.supervisor) self.assign_member_url = reverse('bugs:assign_member', args=[self.bug.id])
def setUp(self): self.superuser = utils.sample_superuser() self.supervisor = utils.sample_member(email="*****@*****.**") self.member = utils.sample_member() self.non_member = utils.sample_member(email="*****@*****.**") self.project = utils.sample_project(creator=self.supervisor) self.project.members.add(self.member) self.project.members.add(self.supervisor) self.project.supervisors.add(self.supervisor) self.bug = utils.sample_bug(creator=self.superuser, project=self.project) self.client = Client() self.message_create_url = reverse('bugs:create_message', args=[self.bug.id])
def setUp(self): self.superuser = utils.sample_superuser(email='*****@*****.**') self.supervisor = utils.sample_member(email='*****@*****.**') self.creator = utils.sample_member(email='*****@*****.**') self.assigned = utils.sample_member(email='*****@*****.**') self.member = utils.sample_member(email='*****@*****.**') self.project = utils.sample_project(creator=self.supervisor) self.project.members.add(self.supervisor) self.project.members.add(self.creator) self.project.members.add(self.assigned) self.project.members.add(self.member) self.project.supervisors.add(self.supervisor) self.bug = utils.sample_bug(creator=self.creator, project=self.project) self.bug.assigned_members.add(self.assigned) self.client = Client() self.detail_url = reverse('bugs:detail', args=[self.bug.id])
def setUp(self): self.client = Client() self.member = utils.sample_member() self.creator = utils.sample_member(email="*****@*****.**") self.superuser = utils.sample_superuser() self.project = utils.sample_project() self.project.members.add(self.creator) self.bug = utils.sample_bug(creator=self.creator, project=self.project) self.list_url = reverse('bugs:list') self.detail_url = reverse('bugs:detail', args=[self.bug.id]) self.create_url = reverse('bugs:create') self.update_url = reverse('bugs:update', args=[self.bug.id]) self.creator_update_url = reverse('bugs:creator_update', args=[self.bug.id]) self.assign_member_url = reverse('bugs:assign_member', args=[self.bug.id]) self.change_status_url = reverse('bugs:change_status', args=[self.bug.id]) self.change_working_status_url = reverse('bugs:change_working_status', args=[self.bug.id]) self.bugPayload = {'title': 'Tmp', 'project': self.project.id}