def test_expired_token_is_recreated_on_successful_authentication(self):
        user = get_user_model().objects.get(username=self.username)
        self.assertIsNotNone(user.token_lifetime)
        response = self.client.post(
            self.auth_url, data={'username': self.username, 'password': self.password}
        )
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        token1 = response.data['token']

        mocked_now = timezone.now() + timezone.timedelta(seconds=user.token_lifetime)
        with freeze_time(mocked_now):
            response = self.client.post(
                self.auth_url,
                data={'username': self.username, 'password': self.password},
            )
            token2 = response.data['token']
            self.assertNotEqual(token1, token2)