def test_delete_user(self): staff = UserProfile.objects.get(username='******') req = req_factory_factory(reverse('lookup.user_delete', args=[self.user.id]), user=staff, post=True, data={'delete_reason': 'basketball reasons'}) r = user_delete(req, self.user.id) self.assert3xx(r, reverse('lookup.user_summary', args=[self.user.id])) # Test data. assert UserProfile.objects.get(id=self.user.id).deleted eq_( staff, ActivityLog.objects.for_user(self.user).filter( action=amo.LOG.DELETE_USER_LOOKUP.id)[0].user) # Test frontend. req = req_factory_factory(reverse('lookup.user_summary', args=[self.user.id]), user=staff) r = user_summary(req, self.user.id) eq_(r.status_code, 200) doc = pq(r.content) eq_(doc('#delete-user dd:eq(1)').text(), 'basketball reasons')
def test_delete_user(self): staff = UserProfile.objects.get(username='******') req = req_factory_factory( reverse('lookup.user_delete', args=[self.user.id]), user=staff, post=True, data={'delete_reason': 'basketball reasons'}) r = user_delete(req, self.user.id) self.assert3xx(r, reverse('lookup.user_summary', args=[self.user.id])) # Test data. assert UserProfile.objects.get(id=self.user.id).deleted eq_(staff, ActivityLog.objects.for_user(self.user).filter( action=amo.LOG.DELETE_USER_LOOKUP.id)[0].user) # Test frontend. req = req_factory_factory( reverse('lookup.user_summary', args=[self.user.id]), user=staff) r = user_summary(req, self.user.id) eq_(r.status_code, 200) doc = pq(r.content) eq_(doc('#delete-user dd:eq(1)').text(), 'basketball reasons')