def test_message_with_url_is_link(self): m = Message(message="Go to http://bit.ly/sample-demo", is_global=True, is_active=True, url="/") m.save() ok_('Go to <a href="http://bit.ly/sample-demo">' 'http://bit.ly/sample-demo</a>' in soapbox_messages(get_soapbox_messages("/")))
def test_subsection_message(self): m = Message(message='Search down', is_global=False, is_active=True, url='/search') m.save() assert 0 == len(get_soapbox_messages('/')) assert 0 == len(get_soapbox_messages('/docs')) assert 0 == len(get_soapbox_messages('/en-US/docs')) assert m.message == get_soapbox_messages('/en-US/search')[0].message assert m.message == get_soapbox_messages('/de/search')[0].message
def test_inactive(self): m = Message(message="Demos", is_global=False, is_active=False, url="/demos/") m.save() url = reverse("demos") r = self.client.get(url, follow=True) eq_(200, r.status_code) doc = pq(r.content) eq_([], doc.find("div.global-notice"))
def test_global_home(self): m = Message(message='Global', is_global=True, is_active=True, url='/') m.save() url = reverse('home') r = self.client.get(url, follow=True) eq_(200, r.status_code) doc = pq(r.content) eq_(m.message, doc.find('div.global-notice').text())
def test_subsection_message(self): m = Message(message="Derby", is_global=False, is_active=True, url="/demos/devderby") m.save() eq_(0, len(get_soapbox_messages("/"))) eq_(0, len(get_soapbox_messages("/demos"))) eq_(0, len(get_soapbox_messages("/en-US/demos"))) eq_(m.message, get_soapbox_messages( "/en-US/demos/devderby")[0].message) eq_(m.message, get_soapbox_messages("/de/demos/devderby")[0].message)
def test_inactive(self): m = Message(message='Search', is_global=False, is_active=False, url='/search/') m.save() url = reverse('search') r = self.client.get(url, follow=True) eq_(200, r.status_code) doc = pq(r.content) eq_([], doc.find('div.global-notice'))
def test_inactive(self): m = Message(message="Demos", is_global=False, is_active=False, url="/demos/") m.save() url = reverse('demos') r = self.client.get(url, follow=True) eq_(200, r.status_code) doc = pq(r.content) eq_([], doc.find('div.global-notice'))
def test_inactive(self): m = Message(message="Search", is_global=False, is_active=False, url="/search/") m.save() url = reverse("search") r = self.client.get(url, follow=True) assert 200 == r.status_code doc = pq(r.content) assert not doc.find("div.global-notice")
def test_inactive(self): m = Message(message='Search', is_global=False, is_active=False, url='/search/') m.save() url = reverse('search') r = self.client.get(url, follow=True) assert 200 == r.status_code doc = pq(r.content) assert not doc.find('div.global-notice')
def test_global_home(self): m = Message(message="Global", is_global=True, is_active=True, url="/") m.save() url = reverse('home') r = self.client.get(url, follow=True) eq_(200, r.status_code) doc = pq(r.content) eq_(m.message, doc.find('div.global-notice').text()) url = reverse('events') r = self.client.get(url, follow=True) eq_(200, r.status_code) doc = pq(r.content) eq_(m.message, doc.find('div.global-notice').text())
def test_global_home(self): m = Message(message="Global", is_global=True, is_active=True, url="/") m.save() url = reverse("home") r = self.client.get(url, follow=True) eq_(200, r.status_code) doc = pq(r.content) eq_(m.message, doc.find("div.global-notice").text()) url = reverse("demos") r = self.client.get(url, follow=True) eq_(200, r.status_code) doc = pq(r.content) eq_(m.message, doc.find("div.global-notice").text())
def test_subsection(self): m = Message(message="Events", is_global=False, is_active=True, url="/events/") m.save() url = reverse("events") r = self.client.get(url, follow=True) eq_(200, r.status_code) doc = pq(r.content) eq_(m.message, doc.find("div.global-notice").text()) url = reverse("home") r = self.client.get(url, follow=True) eq_(200, r.status_code) doc = pq(r.content) eq_([], doc.find("div.global-notice"))
def test_subsection(self): m = Message(message='Search', is_global=False, is_active=True, url='/search/') m.save() url = reverse('search') r = self.client.get(url, follow=True) eq_(200, r.status_code) doc = pq(r.content) eq_(m.message, doc.find('div.global-notice').text()) url = reverse('home') r = self.client.get(url, follow=True) eq_(200, r.status_code) doc = pq(r.content) eq_([], doc.find('div.global-notice'))
def test_global_message(self): m = Message(message="Global", is_global=True, is_active=True, url="/") m.save() eq_(m.message, get_soapbox_messages("/")[0].message) eq_(m.message, get_soapbox_messages("/en-US/")[0].message) eq_(m.message, get_soapbox_messages("/fr/demos/")[0].message)
def test_global_message(self): m = Message(message='Global', is_global=True, is_active=True, url='/') m.save() assert m.message == get_soapbox_messages('/')[0].message assert m.message == get_soapbox_messages('/en-US/')[0].message
def test_global_message(self): m = Message(message="Global", is_global=True, is_active=True, url="/") m.save() assert m.message == get_soapbox_messages("/")[0].message assert m.message == get_soapbox_messages("/en-US/")[0].message
def test_message_with_url_is_link(self): m = Message(message='Go to http://bit.ly/sample-demo', is_global=True, is_active=True, url='/') m.save() assert 'Go to <a href="http://bit.ly/sample-demo" rel="noopener">' \ 'http://bit.ly/sample-demo</a>' in soapbox_messages(get_soapbox_messages('/'))