当前位置: 首页>>代码示例>>Python>>正文


Python Message.save方法代码示例

本文整理汇总了Python中soapbox.models.Message.save方法的典型用法代码示例。如果您正苦于以下问题:Python Message.save方法的具体用法?Python Message.save怎么用?Python Message.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在soapbox.models.Message的用法示例。


在下文中一共展示了Message.save方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_message_with_url_is_link

# 需要导入模块: from soapbox.models import Message [as 别名]
# 或者: from soapbox.models.Message import save [as 别名]
 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("/")))
开发者ID:VoodooLab,项目名称:kuma,代码行数:9,代码来源:test_helpers.py

示例2: test_subsection_message

# 需要导入模块: from soapbox.models import Message [as 别名]
# 或者: from soapbox.models.Message import save [as 别名]
 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
开发者ID:Elchi3,项目名称:kuma,代码行数:11,代码来源:test_helpers.py

示例3: test_subsection_message

# 需要导入模块: from soapbox.models import Message [as 别名]
# 或者: from soapbox.models.Message import save [as 别名]
 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)
开发者ID:VoodooLab,项目名称:kuma,代码行数:12,代码来源:test_helpers.py

示例4: test_inactive

# 需要导入模块: from soapbox.models import Message [as 别名]
# 或者: from soapbox.models.Message import save [as 别名]
    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"))
开发者ID:riverspirit,项目名称:kuma,代码行数:12,代码来源:test_views.py

示例5: test_global_home

# 需要导入模块: from soapbox.models import Message [as 别名]
# 或者: from soapbox.models.Message import save [as 别名]
    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())
开发者ID:MatonAnthony,项目名称:kuma,代码行数:12,代码来源:test_views.py

示例6: test_inactive

# 需要导入模块: from soapbox.models import Message [as 别名]
# 或者: from soapbox.models.Message import save [as 别名]
    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'))
开发者ID:MatonAnthony,项目名称:kuma,代码行数:13,代码来源:test_views.py

示例7: test_global_home

# 需要导入模块: from soapbox.models import Message [as 别名]
# 或者: from soapbox.models.Message import save [as 别名]
    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())
开发者ID:riverspirit,项目名称:kuma,代码行数:19,代码来源:test_views.py

示例8: test_subsection

# 需要导入模块: from soapbox.models import Message [as 别名]
# 或者: from soapbox.models.Message import save [as 别名]
    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"))
开发者ID:Edinunzio,项目名称:kuma,代码行数:19,代码来源:test_views.py

示例9: test_global_message

# 需要导入模块: from soapbox.models import Message [as 别名]
# 或者: from soapbox.models.Message import save [as 别名]
 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)
开发者ID:VoodooLab,项目名称:kuma,代码行数:8,代码来源:test_helpers.py

示例10: test_message_with_url_is_link

# 需要导入模块: from soapbox.models import Message [as 别名]
# 或者: from soapbox.models.Message import save [as 别名]
 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('/'))
开发者ID:Elchi3,项目名称:kuma,代码行数:8,代码来源:test_helpers.py

示例11: test_global_message

# 需要导入模块: from soapbox.models import Message [as 别名]
# 或者: from soapbox.models.Message import save [as 别名]
 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
开发者ID:Elchi3,项目名称:kuma,代码行数:7,代码来源:test_helpers.py


注:本文中的soapbox.models.Message.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。