# Path: multiseek/models.py
# class SearchForm(models.Model):
#     name = models.TextField(verbose_name=_("Name"), unique=True)
#     owner = models.ForeignKey(settings.AUTH_USER_MODEL,
#                               on_delete=models.CASCADE)
#     public = models.BooleanField(
#         verbose_name=_("Public"),
#         default=False, help_text=_(
#             "Make this search publicly available?"))
#     data = models.TextField(verbose_name=_("Form data (JSON)"))
# 
#     objects = SearchFormManager()
# 
#     class Meta:
#         ordering = ['name',]
# 
#     def __str__(self):
#         return self.name


from django.contrib.auth.models import AnonymousUser, User
from django.test import TransactionTestCase
from multiseek.models import SearchForm
from model_bakery import baker
# -*- encoding: utf-8 -*-



class TestModels(TransactionTestCase):
    def test_search_form_manager(self):
        u = baker.make(User)

        s1 = baker.make(SearchForm, owner=u, public=False, name='A')
        s2 = baker.make(SearchForm, owner=u, public=True, name='B')


# Path: multiseek/models.py
# class SearchForm(models.Model):
#     name = models.TextField(verbose_name=_("Name"), unique=True)
#     owner = models.ForeignKey(settings.AUTH_USER_MODEL,
#                               on_delete=models.CASCADE)
#     public = models.BooleanField(
#         verbose_name=_("Public"),
#         default=False, help_text=_(
#             "Make this search publicly available?"))
#     data = models.TextField(verbose_name=_("Form data (JSON)"))
# 
#     objects = SearchFormManager()
# 
#     class Meta:
#         ordering = ['name',]
# 
#     def __str__(self):
#         return self.name


# Path: multiseek/tests/test_models.py
from django.contrib.auth.models import AnonymousUser, User
from django.test import TransactionTestCase
from multiseek.models import SearchForm
from model_bakery import baker

# -*- encoding: utf-8 -*-



class TestModels(TransactionTestCase):
    def test_search_form_manager(self):
        u = baker.make(User)

        s1 = baker.make(SearchForm, owner=u, public=False, name='A')
        s2 = baker.make(SearchForm, owner=u, public=True, name='B')


        res = SearchForm.objects.get_for_user(AnonymousUser())