Пример #1
0
    def test_add_widget_unknown(self):
        """
        Tries to add unknown widget

        404 must be responsed
        """
        request = build_request()
        response = add_widget(request, "unknownidentifier")
        self.assert_equals(response.status_code, 404)
Пример #2
0
    def test_add_widget_unknown(self):
        """
        Tries to add unknown widget

        404 must be responsed
        """
        request = build_request()
        response = add_widget(request, 'unknownidentifier')
        self.assert_equals(response.status_code, 404)
Пример #3
0
 def test_add_widget_allready_in_page(self):
     """
     Add to page an allready assigned widget
     """
     request = build_request()
     response = add_widget(request, "widgetidentifier")
     self.assert_equals(response.status_code, 302)
     # was custom page created?
     # TODO if configuration via add_widget is not possible, custom page should NOT be created
     self.assert_equals(Page.objects.count(), 2)
     page = Page.objects.exclude(pk=settings.DEFAULT_PAGE_ID).get()
     # wasn't new wil created?
     self.assert_equals(len(page.layout.widgets), 3)
Пример #4
0
 def test_add_widget_allready_in_page(self):
     """
     Add to page an allready assigned widget
     """
     request = build_request()
     response = add_widget(request, 'widgetidentifier')
     self.assert_equals(response.status_code, 302)
     # was custom page created?
     # TODO if configuration via add_widget is not possible, custom page should NOT be created
     self.assert_equals(Page.objects.count(), 2)
     page = Page.objects.exclude(pk=settings.DEFAULT_PAGE_ID).get()
     # wasn't new wil created?
     self.assert_equals(len(page.layout.widgets), 3)
Пример #5
0
 def test_add_widget(self):
     """
     Add a new widget to page
     """
     widget = Widget.objects.create(title="New Widget", slug="new-widget")
     settings.EXTERNALY_ADDABLE_WIGDETS["newwidgetident"] = widget.pk
     request = build_request()
     response = add_widget(request, "newwidgetident")
     # redirection after success assertion
     self.assert_equals(response.status_code, 302)
     # was custom page created?
     self.assert_equals(Page.objects.count(), 2)
     page = Page.objects.exclude(pk=settings.DEFAULT_PAGE_ID).get()
     # was new wil created?
     self.assert_equals(len(page.layout.widgets), 4)
Пример #6
0
 def test_add_widget(self):
     """
     Add a new widget to page
     """
     widget = Widget.objects.create(title='New Widget', slug='new-widget')
     settings.EXTERNALY_ADDABLE_WIGDETS['newwidgetident'] = widget.pk
     request = build_request()
     response = add_widget(request, 'newwidgetident')
     # redirection after success assertion
     self.assert_equals(response.status_code, 302)
     # was custom page created?
     self.assert_equals(Page.objects.count(), 2)
     page = Page.objects.exclude(pk=settings.DEFAULT_PAGE_ID).get()
     # was new wil created?
     self.assert_equals(len(page.layout.widgets), 4)