Ejemplo n.º 1
0
 def test_GET_has_merge_form_with_members(self):
     request = self.factory.get('?members=%s&members=%s' % (self.cm1.pk, self.cm2.pk))
     view = MergeCouncilMembersView.as_view()
     response = view(request)
     assert_in('form', response.context_data)
     assert_in(self.cm1, response.context_data['form'].fields['primary'].queryset)
     assert_in(self.cm2, response.context_data['form'].fields['primary'].queryset)
Ejemplo n.º 2
0
 def test_has_appropriate_members_queryset(self):
     request = self.factory.get('?members=%s&members=%s' %
                                (self.cm1.pk, self.cm2.pk))
     members_qs = MergeCouncilMembersView().get_members_queryset(request)
     assert_equal(len(members_qs), 2)
     assert_in(self.cm1, members_qs)
     assert_in(self.cm2, members_qs)
Ejemplo n.º 3
0
 def test_GET_has_merge_form_with_members(self):
     request = self.factory.get('?members=%s&members=%s' %
                                (self.cm1.pk, self.cm2.pk))
     view = MergeCouncilMembersView.as_view()
     response = view(request)
     assert_in('form', response.context_data)
     assert_in(self.cm1,
               response.context_data['form'].fields['primary'].queryset)
     assert_in(self.cm2,
               response.context_data['form'].fields['primary'].queryset)
Ejemplo n.º 4
0
 def test_POST_with_invalid_form_rerenders_successfully(self):
     request = self.factory.post('', data={'members': [self.cm1.pk, self.cm2.pk]})
     view = MergeCouncilMembersView.as_view()
     response = view(request)
     assert_equal(response.status_code, 200)
Ejemplo n.º 5
0
 def test_POST_with_invalid_form_rerenders_successfully(self):
     request = self.factory.post(
         '', data={'members': [self.cm1.pk, self.cm2.pk]})
     view = MergeCouncilMembersView.as_view()
     response = view(request)
     assert_equal(response.status_code, 200)