# Path: lifeblog/models.py
# class Document(models.Model):
#     # 문서 Model
#     def __str__(self):
#         return self.title
# 
#     id = models.AutoField(primary_key=True)
#     title = models.CharField(max_length=100)
#     content = models.TextField()
#     time = models.DateTimeField(auto_now_add=True)
#     meta_tag = models.CharField(max_length=150)
#     view_count = models.IntegerField(default=0, editable=False)
#     public_doc = models.BooleanField()
#     update_time = models.DateTimeField(auto_now=True)
#     is_markdown = models.BooleanField()
# 
#     def read(self):
#         self.view_count += 1
#         self.save()
# 
#     @models.permalink
#     def get_absolute_url(self):
#         return 'detail', (), {'document_id': self.id}
# 
#     @classmethod
#     def search_document(cls, query):
#         if len(query) == 0:
#             return None
#         return cls.objects.filter(
#             (Q(title__icontains=query) | Q(content__icontains=query))
#             & Q(public_doc=True))


from django.test import LiveServerTestCase, Client
from .models import Document


class DocumentTest(LiveServerTestCase):
    def setUp(self):
        self.test_public_doc = Document.objects.create(
            title="DocumentTest Title",
            content="DocumentTest Content content",
            meta_tag="metametametametametametametameta",
            public_doc=True)
        

# Path: lifeblog/models.py
# class Document(models.Model):
#     # 문서 Model
#     def __str__(self):
#         return self.title
# 
#     id = models.AutoField(primary_key=True)
#     title = models.CharField(max_length=100)
#     content = models.TextField()
#     time = models.DateTimeField(auto_now_add=True)
#     meta_tag = models.CharField(max_length=150)
#     view_count = models.IntegerField(default=0, editable=False)
#     public_doc = models.BooleanField()
#     update_time = models.DateTimeField(auto_now=True)
#     is_markdown = models.BooleanField()
# 
#     def read(self):
#         self.view_count += 1
#         self.save()
# 
#     @models.permalink
#     def get_absolute_url(self):
#         return 'detail', (), {'document_id': self.id}
# 
#     @classmethod
#     def search_document(cls, query):
#         if len(query) == 0:
#             return None
#         return cls.objects.filter(
#             (Q(title__icontains=query) | Q(content__icontains=query))
#             & Q(public_doc=True))


# Path: lifeblog/tests.py
from django.test import LiveServerTestCase, Client
from .models import Document



class DocumentTest(LiveServerTestCase):
    def setUp(self):
        self.test_public_doc = Document.objects.create(
            title="DocumentTest Title",
            content="DocumentTest Content content",
            meta_tag="metametametametametametametameta",
            public_doc=True)
        

        self.test_private_doc = Document.objects.create(