from django.http import HttpRequest
from django.test import TestCase

from jellyblog.views import index
from .models import Note


class NoteViewTest(TestCase):
    def setUp(self):
        self.note_content1 = "note test 111"
        self.note_content2 = "note test 222"
        Note.objects.create(content=self.note_content1)
        Note.objects.create(content=self.note_content2)

    def test_get_notes(self):
        request = HttpRequest()
        response = index(request)

        self.assertIn(self.note_content1, response.content.decode())
        self.assertIn(self.note_content2, response.content.decode())

@@ -117,20 +117,40 @@
  import 
-Note
+Category, Note, Document
 %0A%0A%0Aclass
@@ -564,16 +564,16 @@
 code())%0A
-
         
@@ -613,28 +613,589 @@
  response.content.decode())%0A
+%0A%0Aclass DocumentViewTest(TestCase):%0A    def setUp(self):%0A        Category.init_category()%0A        category = Category.objects.get(pk=1)%0A        self.test_doc1 = Document.objects.create(%0A            category=category,%0A            title=%22Document Test%22,%0A            content=%22Content content content %22,%0A            meta_tag=%22metametametametametameta%22,%0A            public_doc=True%0A        )%0A%0A    def test_get_document(self):%0A        request = HttpRequest()%0A        response = index(request)%0A%0A        self.assertIn(self.test_doc1.title, response.content.decode())%0A%0A%0A

add document view test