def test_current_user_view_for_no_auth(self): """ Don't Returns any data for non auth user """ request = self.factory.get(reverse('taskmng:current_user')) request.user = AnonymousUser() response_json = current_user(request) response = json.loads(response_json.content) self.assertEqual(response['result']['logged'], False)
def test_current_user_view(self): """ Returns current user instance in json """ request = self.factory.get(reverse('taskmng:current_user')) request.user = self.user response_json = current_user(request) response = json.loads(response_json.content) self.assertEqual(response[0]['pk'], 1)