'Test that token regeneration works'

def test_regenerate(self):

    url = u'/v1/auth/tokens/'
    response = self.client.post(url, u'{}', content_type=u'application/json', HTTP_AUTHORIZATION=u'token    {}'.format(self.admin_token))
    self.assertEqual(response.status_code, 200)
    self.assertNotEqual(response.data[u'token'], self.admin_token)
    self.admin_token = Token.objects.get(user=self.admin)
    response = self.client.post(url, u'{"username"    :    "autotest2"}', content_type=u'application/json', HTTP_AUTHORIZATION=u'token    {}'.format(self.admin_token))
    self.assertEqual(response.status_code, 200)
    self.assertNotEqual(response.data[u'token'], self.user1_token)
    response = self.client.post(url, u'{"all"    :    "true"}', content_type=u'application/json', HTTP_AUTHORIZATION=u'token    {}'.format(self.admin_token))
    self.assertEqual(response.status_code, 200)
    response = self.client.post(url, u'{}', content_type=u'application/json', HTTP_AUTHORIZATION=u'token    {}'.format(self.admin_token))
    self.assertEqual(response.status_code, 401)
