예제 #1
0
 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("/")))
예제 #2
0
파일: test_helpers.py 프로젝트: Elchi3/kuma
 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
예제 #3
0
    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"))
예제 #4
0
    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())
예제 #5
0
 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)
예제 #6
0
    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'))
예제 #7
0
    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'))
예제 #8
0
    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")
예제 #9
0
    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')
예제 #10
0
파일: test_views.py 프로젝트: ouyoung/kuma
    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())
예제 #11
0
    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())
예제 #12
0
    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"))
예제 #13
0
파일: test_views.py 프로젝트: kublaj/kuma
    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'))
예제 #14
0
 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)
예제 #15
0
 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
예제 #16
0
 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)
예제 #17
0
 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
예제 #18
0
파일: test_helpers.py 프로젝트: Elchi3/kuma
 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('/'))
예제 #19
0
파일: test_helpers.py 프로젝트: Elchi3/kuma
 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
예제 #20
0
 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("/")))