def test_add_rss_vidget_bad_feed(self): request = build_request(get_query='feed=http://example.com/INVALID_rss_feed/') response = add_rss_widget(request) # bad request after failure # TODO if not used as ajax rss fedd insertion, return somethin better than bad request self.assert_equals(response.status_code, 400) # wasn't custom page created? self.assert_equals(Page.objects.count(), 1)
def test_add_rss_vidget_bad_feed(self): request = build_request( get_query='feed=http://example.com/INVALID_rss_feed/') response = add_rss_widget(request) # bad request after failure # TODO if not used as ajax rss fedd insertion, return somethin better than bad request self.assert_equals(response.status_code, 400) # wasn't custom page created? self.assert_equals(Page.objects.count(), 1)
def test_create_and_add_rss_widget(self): request = build_request(get_query='feed=http://example.com/valid_rss_feed/') response = add_rss_widget(request) # redirection after success assertion self.assert_equals(response.status_code, 302) # was new widget created? self.assert_equals(RSSWidget.objects.count(), 1) # 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)
def test_create_and_add_rss_widget(self): request = build_request( get_query='feed=http://example.com/valid_rss_feed/') response = add_rss_widget(request) # redirection after success assertion self.assert_equals(response.status_code, 302) # was new widget created? self.assert_equals(RSSWidget.objects.count(), 1) # 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)
def test_add_rss_vidget_bad_arg(self): request = build_request() response = add_rss_widget(request) self.assert_equals(response.status_code, 400)