<commit_before>from django.test import TestCase

# Create your tests here.<commit_msg>added models tests<commit_after>from django.test import TestCase, TransactionTestCase
from .models import Tag, Recent, Vault
from django.utils import timezone
from rest_framework.test import APIRequestFactory, APIClient
from django.contrib.auth.models import User


class ModelTest(TransactionTestCase):
    """
    Test all models
    """
    reset_sequences = True

    def setUp(self):
        tag = Tag.objects.create(name='tag object')
        vault = Vault.objects.create(site_url='http://xyz.com', username='prism',
                                     email='<EMAIL>', password='<PASSWORD>', note='note', tag=tag)
        Recent.objects.create(vault=vault)

    def test_tag_model(self):
        tag_item = Tag.objects.all()
        self.assertEqual(tag_item.count(), 1)

        tag_result = Tag.objects.get(name="tag object")
        self.assertEqual(tag_result.name, "tag object")

    def test_vault_model(self):
        vault_items = Vault.objects.all()
        self.assertEqual(vault_items.count(), 1)
        self.assertEqual(vault_items[0].site_url, 'http://xyz.com')
        self.assertEqual(vault_items[0].username, 'prism')
        self.assertEqual(vault_items[0].email, '<EMAIL>')
        self.assertEqual(vault_items[0].password, '<PASSWORD>')
        self.assertEqual(vault_items[0].note, 'note')
        self.assertEqual(vault_items[0].tag.id, 1)

    def test_recent_model(self):
        recent_items = Recent.objects.all()
        self.assertEqual(recent_items.count(), 1)
        self.assertEqual(recent_items[0].vault.id, 1)
{'fraction_non_alphanumeric': 0.12767257177764202, 'fraction_numerical': 0.007330482590103849, 'mean_word_length': 3.368, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6297796', 'n_tokens_mistral': 504, 'n_tokens_neox': 491, 'n_words': 91}