Beispiel #1
0
 def setUp(self):
     # create root page
     root_page = Page.objects.get(title="Root")
     # create homepage
     homepage = HomePage(
         title="Hello World",
         slug="hello-world",
     )
     # add homepage to root page
     root_page.add_child(instance=homepage)
     # create book index page
     book_index = BookIndex(
         title="Book Index",
         page_description="Test",
         dev_standard_1_description="Test",
         dev_standard_2_description="Test",
         dev_standard_3_description="Test",
     )
     # add book index to homepage
     homepage.add_child(instance=book_index)
     # create book (finally! needed for Errata reports)
     book = Book(
         cnx_id='d50f6e32-0fda-46ef-a362-9bd36ca7c97d',
         title='University Physics',
         salesforce_abbreviation='University Phys (Calc)',
         salesforce_name='University Physics',
         description="Test Book",
     )
     book_index.add_child(instance=book)
Beispiel #2
0
    def test_can_create_errata_list_page(self):
        root_page = Page.objects.get(title="Root")
        homepage = HomePage(title="Hello World",
                            slug="hello-world",
                            )
        root_page.add_child(instance=homepage)
        errata_list_page = ErrataList(title="Errata List Template",
                                      correction_schedule="Some sample correction schedule text.")
        homepage.add_child(instance=errata_list_page)

        retrieved_page = Page.objects.get(id=errata_list_page.id)
        self.assertEqual(retrieved_page.title, "Errata List Template")
Beispiel #3
0
    def setUpTestData(cls):
        # create root page
        root_page = Page.objects.get(title="Root")
        # create homepage
        homepage = HomePage(
            title="Hello World",
            slug="hello-world",
        )
        # add homepage to root page
        root_page.add_child(instance=homepage)
        # create book index page
        news_index = NewsIndex(title="News Index")
        # add book index to homepage
        homepage.add_child(instance=news_index)

        cls.news_index = Page.objects.get(id=news_index.id)
Beispiel #4
0
    def test_can_create_book_index(self):
        #create root page
        root_page = Page.objects.get(title="Root")
        #create homepage
        homepage = HomePage(title="Hello World",
                            slug="hello-world",
                            )
        #add homepage to root page
        root_page.add_child(instance=homepage)
        #create book index page
        book_index = BookIndex(title="Book Index",
                               page_description="Test",
                               dev_standard_1_description="Test",
                               dev_standard_2_description="Test",
                               dev_standard_3_description="Test",
                               )
        #add book index to homepage
        homepage.add_child(instance=book_index)

        retrieved_page = Page.objects.get(id=book_index.id)
        self.assertEqual(retrieved_page.title, "Book Index")
Beispiel #5
0
    def setUpTestData(cls):
        # create root page
        root_page = Page.objects.get(title="Root")
        # create homepage
        homepage = HomePage(
            title="Hello World",
            slug="hello-world",
        )
        # add homepage to root page
        root_page.add_child(instance=homepage)
        # create book index page
        book_index = BookIndex(
            title="Book Index",
            page_description="Test",
            dev_standard_1_description="Test",
            dev_standard_2_description="Test",
            dev_standard_3_description="Test",
        )
        # add book index to homepage
        homepage.add_child(instance=book_index)

        cls.book_index = Page.objects.get(id=book_index.id)
Beispiel #6
0
 def setUp(self):
     # create root page
     root_page = Page.objects.get(title="Root")
     # create homepage
     homepage = HomePage(
         title="Hello World",
         slug="hello-world",
     )
     # add homepage to root page
     root_page.add_child(instance=homepage)
     # create book index page
     book_index = BookIndex(
         title="Book Index",
         page_description="Test",
         dev_standard_1_description="Test",
         dev_standard_2_description="Test",
         dev_standard_3_description="Test",
         dev_standard_4_description="Test",
     )
     # add book index to homepage
     homepage.add_child(instance=book_index)
     # create book (finally! needed for Errata reports)
     test_image = SimpleUploadedFile(
         name='openstax.png',
         content=open("admin_templates/static/images/openstax.png",
                      'rb').read())
     test_doc = Document.objects.create(title='Test Doc', file=test_image)
     book = Book(
         cnx_id='d50f6e32-0fda-46ef-a362-9bd36ca7c97d',
         title='University Physics',
         salesforce_abbreviation='University Phys (Calc)',
         salesforce_name='University Physics',
         description="Test Book",
         cover=test_doc,
         title_image=test_doc,
         publish_date=datetime.date.today(),
     )
     book_index.add_child(instance=book)
Beispiel #7
0
    def setUpTestData(cls):
        # create root page
        root_page = Page.objects.get(title="Root")
        # create homepage
        homepage = HomePage(title="Hello World",
                            slug="hello-world",
                            )
        # add homepage to root page
        root_page.add_child(instance=homepage)
        # create book index page
        book_index = BookIndex(title="Book Index",
                               page_description="Test",
                               dev_standard_1_description="Test",
                               dev_standard_2_description="Test",
                               dev_standard_3_description="Test",
                               )
        # add book index to homepage
        homepage.add_child(instance=book_index)

        test_image = SimpleUploadedFile(name='openstax.png', content=open("admin_templates/static/images/openstax.png", 'rb').read())
        cls.test_doc = Document.objects.create(title='Test Doc', file=test_image)

        cls.book_index = Page.objects.get(id=book_index.id)