'Test the admin delete view for a user with a watched thread.'

@mock.patch.object(Site.objects, 'get_current')
def test_admin_delete_user_with_watched_thread(self, get_current):

    get_current.return_value.domain = 'testserver'
    t = ThreadFactory()
    u = t.creator
    watcher = UserFactory()
    admin_user = UserFactory(is_staff=True, is_superuser=True)
    self.client.login(username=admin_user.username, password='testpass')
    self._toggle_watch_thread_as(t, watcher, turn_on=True)
    url = reverse('admin:auth_user_delete', args=[u.id])
    request = RequestFactory().get(url)
    request.user = admin_user
    request.session = self.client.session
    ModelAdmin(User, admin.site).delete_view(request, str(u.id))
