<commit_before>from proso.django.test import TestCase
import json


class UserAPITest(TestCase):

    def test_anonymous_profile(self):
        response = self.client.get('/user/profile/')
        self.assertEqual(response.status_code, 404, 'There is no profile for anonymous user.')

    def test_signup_and_profile(self):
        # signup
        response = self.client.post('/user/signup/', json.dumps({
            'username': 'new_user',
            'email': '<EMAIL>',
            'password': '<PASSWORD>',
            'password_check': '<PASSWORD>',
        }), content_type='application/json')
        self.assertEqual(response.status_code, 201, 'The user is successfuly created.')
        expected_profile = {
            "send_emails": True,
            "user": {
                "username": "new_user",
                "first_name": "",
                "last_name": "",
                "object_type": "user",
                "email": "<EMAIL>",
                "id": 1,
                "staff": False,
            },
            "object_type": "user_profile",
            "id": 1,
            "public": False
        }
        self.assertEqual(
            json.loads(response.content)['data'], expected_profile,
            'The given profile has been created.'
        )
        # check profile
        response = self.client.get('/user/profile/')
        self.assertEqual(response.status_code, 200, 'There is a profile for user logged in.')
        self.assertEqual(
            json.loads(response.content)['data'], expected_profile,
            'The profile matches.'
        )
        # update profile<commit_msg>fix user api test - ignore user id and profile id<commit_after>from proso.django.test import TestCase
import json


class UserAPITest(TestCase):

    def test_anonymous_profile(self):
        response = self.client.get('/user/profile/')
        self.assertEqual(response.status_code, 404, 'There is no profile for anonymous user.')

    def test_signup_and_profile(self):
        # signup
        response = self.client.post('/user/signup/', json.dumps({
            'username': 'new_user',
            'email': '<EMAIL>',
            'password': '<PASSWORD>',
            'password_check': '<PASSWORD>',
        }), content_type='application/json')
        self.assertEqual(response.status_code, 201, 'The user is successfuly created.')
        expected_profile = {
            "send_emails": True,
            "user": {
                "username": "new_user",
                "first_name": "",
                "last_name": "",
                "object_type": "user",
                "email": "<EMAIL>",
                "id": 1,
                "staff": False,
            },
            "object_type": "user_profile",
            "id": 1,
            "public": False
        }
        response = json.loads(response.content)['data']
        expected_profile["user"]["id"] = response["user"]["id"]
        expected_profile["id"] = response["id"]
        self.assertEqual(
            response, expected_profile,
            'The given profile has been created.'
        )
        # check profile
        response = self.client.get('/user/profile/')
        self.assertEqual(response.status_code, 200, 'There is a profile for user logged in.')
        self.assertEqual(
            json.loads(response.content)['data'], expected_profile,
            'The profile matches.'
        )
        # update profile
{'fraction_non_alphanumeric': 0.13213038416763678, 'fraction_numerical': 0.006402793946449359, 'mean_word_length': 1.9151823579304494, 'pattern_counts': {'":': 24, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2605668', 'n_tokens_mistral': 945, 'n_tokens_neox': 916, 'n_words': 206}