# Path: tests/app/models.py
# class Category(models.Model):
# 
#     name = models.CharField(max_length=255)
#     title = models.CharField(max_length=255)
# 
#     i18n = TranslationField(fields=("name", "title"))
# 
#     objects = CategoryQueryset.as_manager()
# 
#     def __str__(self):
#         return self.name
# 
# class Site(models.Model):
#     name = models.CharField(max_length=255)
# 
#     objects = MultilingualManager()
# 
#     def __str__(self):
#         return self.name
# 
# Path: tests/utils.py
# def load_wiki():
#     wiki = Category.objects.create(name="Wikipedia")
#     with open(os.path.join("tests", "fixtures", "fulltextsearch.json")) as infile:
#         data = json.load(infile)
# 
#         for article in data:
#             kwargs = {}
#             for item in article:
#                 lang = "_" + item["lang"]
# 
#                 kwargs["title" + lang] = item["title"]
#                 kwargs["body" + lang] = item["body"]
# 
#             Blog.objects.create(category=wiki, **kwargs)


from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
from django.utils.translation import override
from .app.models import Category, Site
from .utils import load_wiki


User = get_user_model()

TEST_USERNAME = "admin"
TEST_PASSWORD = "battery-horse-staple"


class AdminTest(TestCase):
    @classmethod
    def setUpTestData(self):
        User.objects.create_superuser(
            username=TEST_USERNAME, email="test@example.com", password=TEST_PASSWORD
        )

# Path: tests/app/models.py
# class Category(models.Model):
# 
#     name = models.CharField(max_length=255)
#     title = models.CharField(max_length=255)
# 
#     i18n = TranslationField(fields=("name", "title"))
# 
#     objects = CategoryQueryset.as_manager()
# 
#     def __str__(self):
#         return self.name
# 
# class Site(models.Model):
#     name = models.CharField(max_length=255)
# 
#     objects = MultilingualManager()
# 
#     def __str__(self):
#         return self.name
# 
# Path: tests/utils.py
# def load_wiki():
#     wiki = Category.objects.create(name="Wikipedia")
#     with open(os.path.join("tests", "fixtures", "fulltextsearch.json")) as infile:
#         data = json.load(infile)
# 
#         for article in data:
#             kwargs = {}
#             for item in article:
#                 lang = "_" + item["lang"]
# 
#                 kwargs["title" + lang] = item["title"]
#                 kwargs["body" + lang] = item["body"]
# 
#             Blog.objects.create(category=wiki, **kwargs)


# Path: tests/test_admin.py
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
from django.utils.translation import override
from .app.models import Category, Site
from .utils import load_wiki



User = get_user_model()

TEST_USERNAME = "admin"
TEST_PASSWORD = "battery-horse-staple"


class AdminTest(TestCase):
    @classmethod
    def setUpTestData(self):
        User.objects.create_superuser(
            username=TEST_USERNAME, email="test@example.com", password=TEST_PASSWORD
        )

        load_wiki()