def test_anonymise__records_anonymised(self):
    obj_1 = FirstSearchModelFactory.create(email='example@example.com', anonymised=False)
    obj_2 = FirstSearchModelFactory.create(email='example@example.com', anonymised=False)
    content_type = ContentType.objects.get_for_model(FirstSearchModel).pk
    response = self.client.post(tool_root_url, {'term': 'example@example.com', 'action': gdpr_assist.admin.tool.PersonalDataSearchForm.ACTION_ANONYMISE, 'obj_pk': ['{}-{}'.format(content_type, obj_1.pk)]}, follow=True)
    obj_1.refresh_from_db()
    obj_2.refresh_from_db()
    self.assertTrue(obj_1.anonymised)
    self.assertFalse(obj_2.anonymised)
    if (django.VERSION <= (1, 9)):
        self.assertEqual(len(response.redirect_chain), 1)
        self.assertTrue(response.redirect_chain[0][0].endswith(tool_root_url))
        self.assertEqual(response.redirect_chain[0][1], 302)
    else:
        self.assertEqual(response.redirect_chain, [(tool_root_url, 302)])
def test_anonymise__records_anonymised(self):
    obj_1 = FirstSearchModelFactory.create(email='example@example.com', anonymised=False)
    obj_2 = FirstSearchModelFactory.create(email='example@example.com', anonymised=False)
    content_type = ContentType.objects.get_for_model(FirstSearchModel).pk
    response = self.client.post(tool_root_url, {'term': 'example@example.com', 'action': gdpr_assist.admin.tool.PersonalDataSearchForm.ACTION_ANONYMISE, 'obj_pk': ['{}-{}'.format(content_type, obj_1.pk)]}, follow=True)
    obj_1.refresh_from_db()
    obj_2.refresh_from_db()
    self.assertTrue(obj_1.anonymised)
    self.assertFalse(obj_2.anonymised)
    if (django.VERSION <= (1, 9)):
        self.assertEqual(len(response.redirect_chain), 1)
        self.assertTrue(response.redirect_chain[0][0].endswith(tool_root_url))
        self.assertEqual(response.redirect_chain[0][1], 302)
    else:
        self.assertEqual(response.redirect_chain, [(tool_root_url, 302)])