def test_anonymise_action_submit__redirect_to_anonymise_view(self):
    obj_1 = ModelWithPrivacyMetaFactory.create()
    obj_2 = ModelWithPrivacyMetaFactory.create()
    response = self.client.post(model_root_url, {'action': 'anonymise', '_selected_action': [obj_1.pk, obj_2.pk]}, follow=True)
    test_url = '{root_url}anonymise/?ids={pk1},{pk2}'.format(root_url=model_root_url, pk1=obj_1.pk, pk2=obj_2.pk)
    if (django.VERSION <= (1, 9)):
        self.assertEqual(len(response.redirect_chain), 1)
        self.assertTrue(response.redirect_chain[0][0].endswith(test_url))
        self.assertEqual(response.redirect_chain[0][1], 302)
    else:
        self.assertEqual(response.redirect_chain, [(test_url, 302)])
    self.assertContains(response, '<p>Are you sure you want to anonymise the following Model With Privacy Metas:</p>')
    self.assertContains(response, '<input type="hidden" name="ids" value="{pk1},{pk2}">'.format(pk1=obj_1.pk, pk2=obj_2.pk))
def test_anonymise_action_submit__redirect_to_anonymise_view(self):
    obj_1 = ModelWithPrivacyMetaFactory.create()
    obj_2 = ModelWithPrivacyMetaFactory.create()
    response = self.client.post(model_root_url, {'action': 'anonymise', '_selected_action': [obj_1.pk, obj_2.pk]}, follow=True)
    test_url = '{root_url}anonymise/?ids={pk1},{pk2}'.format(root_url=model_root_url, pk1=obj_1.pk, pk2=obj_2.pk)
    if (django.VERSION <= (1, 9)):
        self.assertEqual(len(response.redirect_chain), 1)
        self.assertTrue(response.redirect_chain[0][0].endswith(test_url))
        self.assertEqual(response.redirect_chain[0][1], 302)
    else:
        self.assertEqual(response.redirect_chain, [(test_url, 302)])
    self.assertContains(response, '<p>Are you sure you want to anonymise the following Model With Privacy Metas:</p>')
    self.assertContains(response, '<input type="hidden" name="ids" value="{pk1},{pk2}">'.format(pk1=obj_1.pk, pk2=obj_2.pk))