<commit_before>from flask import json
from app.api.v1.tests.base import BaseTestCase


class TestBucketlistItems(BaseTestCase):
    def test_create_item(self):
        with self.client:
            token = self.get_auth_token()
            response = self.create_bucketlist(dict(self.BUCKETLIST_FIELDS), token)
            data = json.loads(response.data.decode())
            id = data['data']['id']

            response = self.create_item(id, self.ITEM_FIELDS, token)
            data = json.loads(response.data.decode())

            self.assertEqual(response.status_code, 201)
            self.assertEqual(data['status'], 'success')
            self.assertEqual(data['message'], 'Bucketlist item created successfully.')

    def test_wrong_bucketlist_id(self):
        with self.client:
            token = self.get_auth_token()
            id = 2

            response = self.create_item(id, self.ITEM_FIELDS, token)
            data = json.loads(response.data.decode())

            self.assertEqual(response.status_code, 400)
            self.assertEqual(data['status'], 'fail')
            self.assertEqual(data['message'], 'Bucketlist does not exist.')

    def test_missing_params(self):
        with self.client:
            token = self.get_auth_token()
            response = self.create_bucketlist(dict(self.BUCKETLIST_FIELDS), token)
            data = json.loads(response.data.decode())

            id = data['data']['id']
            response = self.create_item(id, self.ITEM_FIELDS, token)
            data = json.loads(response.data.decode())
<commit_msg>Fix test_missing_params test<commit_after>from flask import json
from app.api.v1.tests.base import BaseTestCase


class TestBucketlistItems(BaseTestCase):
    def test_create_item(self):
        with self.client:
            token = self.get_auth_token()
            response = self.create_bucketlist(dict(self.BUCKETLIST_FIELDS), token)
            data = json.loads(response.data.decode())
            id = data['data']['id']

            response = self.create_item(id, self.ITEM_FIELDS, token)
            data = json.loads(response.data.decode())

            self.assertEqual(response.status_code, 201)
            self.assertEqual(data['status'], 'success')
            self.assertEqual(data['message'], 'Bucketlist item created successfully.')

    def test_wrong_bucketlist_id(self):
        with self.client:
            token = self.get_auth_token()
            id = 2

            response = self.create_item(id, self.ITEM_FIELDS, token)
            data = json.loads(response.data.decode())

            self.assertEqual(response.status_code, 400)
            self.assertEqual(data['status'], 'fail')
            self.assertEqual(data['message'], 'Bucketlist does not exist.')

    def test_missing_params(self):
        with self.client:
            token = self.get_auth_token()
            response = self.create_bucketlist(dict(self.BUCKETLIST_FIELDS), token)
            data = json.loads(response.data.decode())

            id = data['data']['id']
            response = self.create_item(id, {}, token)
            data = json.loads(response.data.decode())

{'fraction_non_alphanumeric': 0.11766571519188075, 'fraction_numerical': 0.00507453219156359, 'mean_word_length': 2.4966740576496673, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7365999', 'n_tokens_mistral': 900, 'n_tokens_neox': 879, 'n_words': 161}