<commit_before><commit_msg>[TEST]Test for User<commit_after>import unittest
import context
from app.models import User, Bucketlist
from app import app, db
import json
from app import config

class TestUserModel(unittest.TestCase):
    def setUp(self):
        app.config.from_object('config.TestingConfig')
        db.session.close()
        db.drop_all()
        db.create_all()
        user = User('test', '<PASSWORD>','<EMAIL>')
        db.session.add(user)
        db.session.commit()
        self.app = app.test_client()
        self.user = user
        return self.app, self.user

    def registration(self, email, password, name):
        return self.app.post('/auth/register', data=dict(
    email=email,
    password=password,
    name=name
        ))

    def test_register_new_user(self):
        rv = self.registration('test', '<EMAIL>', '<PASSWORD>')
        data = json.loads(rv.data.decode())
        self.assertEqual('user added succesfully', data['message'])

    def login(self, email, password):
        return self.app.post('/auth/login', data=dict(
            email=email,
            password=password
        ))
    def test_login(self):
        rv = self.login('test', '<PASSWORD>')
        data = json.loads(rv.data.decode())
        self.assertEqual('You have successfully logged in', data['message'])
{'fraction_non_alphanumeric': 0.1355421686746988, 'fraction_numerical': 0.0, 'mean_word_length': 2.7755681818181817, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '5902470', 'n_tokens_mistral': 389, 'n_tokens_neox': 386, 'n_words': 87}