• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python fake.bs函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.base.fake.bs函数的典型用法代码示例。如果您正苦于以下问题:Python bs函数的具体用法?Python bs怎么用?Python bs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: test_node_child_filtering

    def test_node_child_filtering(self):
        user = AuthUserFactory()
        project = ProjectFactory(creator=user)

        title1, title2 = fake.bs(), fake.bs()
        component = NodeFactory(title=title1, parent=project)
        component2 = NodeFactory(title=title2, parent=project)

        url = "/{}nodes/{}/children/?filter[title]={}".format(API_BASE, project._id, title1)
        res = self.app.get(url, auth=user.auth)

        ids = [node["id"] for node in res.json["data"]]

        assert_in(component._id, ids)
        assert_not_in(component2._id, ids)
开发者ID:ccfair,项目名称:osf.io,代码行数:15,代码来源:test_node_children_list.py


示例2: setUp

    def setUp(self):
        OsfTestCase.setUp(self)

        self.user = AuthUserFactory()
        self.me = AuthUserFactory()
        self.project = ProjectFactory(creator=self.me, is_public=True, title=fake.bs())
        self.component = NodeFactory(creator=self.me, project=self.project, is_public=True, title=fake.bs())
开发者ID:baylee-d,项目名称:osf.io,代码行数:7,代码来源:webtest_tests.py


示例3: test_cannot_update_a_retraction

 def test_cannot_update_a_retraction(self):
     registration = RegistrationFactory(creator=self.user, project=self.public_project)
     url = "/{}nodes/{}/".format(API_BASE, registration._id)
     retraction = RetractedRegistrationFactory(registration=registration, user=registration.creator)
     res = self.app.put_json_api(
         url,
         {
             "data": {
                 "id": registration._id,
                 "type": "nodes",
                 "attributes": {
                     "title": fake.catch_phrase(),
                     "description": fake.bs(),
                     "category": "hypothesis",
                     "public": True,
                 },
             }
         },
         auth=self.user.auth,
         expect_errors=True,
     )
     registration.reload()
     assert_equal(res.status_code, 404)
     assert_equal(registration.title, registration.title)
     assert_equal(registration.description, registration.description)
开发者ID:kch8qx,项目名称:osf.io,代码行数:25,代码来源:test_node_detail.py


示例4: test_send_with_sendgrid_success

    def test_send_with_sendgrid_success(self):
        mock_client = mock.MagicMock()
        mock_client.send.return_value = 200, 'success'
        from_addr, to_addr = fake_email(), fake_email()
        category1, category2 = fake.word(), fake.word()
        subject = fake.bs()
        message = fake.text()
        ret = _send_with_sendgrid(
            from_addr=from_addr,
            to_addr=to_addr,
            subject=subject,
            message=message,
            mimetype='html',
            client=mock_client,
            categories=(category1, category2)
        )
        assert_true(ret)

        assert_equal(mock_client.send.call_count, 1)
        # First call's argument should be a Mail object with
        # the correct configuration
        first_call_arg = mock_client.send.call_args[0][0]
        assert_is_instance(first_call_arg, sendgrid.Mail)
        assert_equal(first_call_arg.from_email, from_addr)
        assert_equal(first_call_arg.to[0], to_addr)
        assert_equal(first_call_arg.subject, subject)
        assert_in(message, first_call_arg.html)
        # Categories are set
        assert_equal(first_call_arg.smtpapi.data['category'], (category1, category2))
开发者ID:erinspace,项目名称:osf.io,代码行数:29,代码来源:test_email.py


示例5: test_cannot_bulk_create_children_on_a_registration

    def test_cannot_bulk_create_children_on_a_registration(self):
        registration = RegistrationFactory(project=self.project, creator=self.user)
        url = "/{}nodes/{}/children/".format(API_BASE, registration._id)
        res = self.app.post_json_api(
            url,
            {
                "data": [
                    self.child_two,
                    {
                        "type": "nodes",
                        "attributes": {
                            "title": fake.catch_phrase(),
                            "description": fake.bs(),
                            "category": "project",
                            "public": True,
                        },
                    },
                ]
            },
            auth=self.user.auth,
            expect_errors=True,
            bulk=True,
        )
        assert_equal(res.status_code, 404)

        self.project.reload()
        assert_equal(len(self.project.nodes), 0)
开发者ID:ccfair,项目名称:osf.io,代码行数:27,代码来源:test_node_children_list.py


示例6: test_node_child_filtering

    def test_node_child_filtering(self, app, user):
        project = ProjectFactory(creator=user)

        title_one, title_two = fake.bs(), fake.bs()
        component = NodeFactory(title=title_one, parent=project)
        component_two = NodeFactory(title=title_two, parent=project)

        url = '/{}nodes/{}/children/?filter[title]={}'.format(
            API_BASE,
            project._id,
            title_one
        )
        res = app.get(url, auth=user.auth)

        ids = [node['id'] for node in res.json['data']]

        assert component._id in ids
        assert component_two._id not in ids
开发者ID:erinspace,项目名称:osf.io,代码行数:18,代码来源:test_node_children_list.py


示例7: test_cannot_create_child_on_a_registration

 def test_cannot_create_child_on_a_registration(self, app, user, project):
     registration = RegistrationFactory(project=project, creator=user)
     url = '/{}nodes/{}/children/'.format(API_BASE, registration._id)
     res = app.post_json_api(url, {
         'data': {
             'type': 'nodes',
             'attributes': {
                 'title': fake.catch_phrase(),
                 'description': fake.bs(),
                 'category': 'project',
                 'public': True,
             }
         }
     }, auth=user.auth, expect_errors=True)
     assert res.status_code == 404
开发者ID:erinspace,项目名称:osf.io,代码行数:15,代码来源:test_node_children_list.py


示例8: test_send_with_sendgrid_failure_returns_false

 def test_send_with_sendgrid_failure_returns_false(self):
     mock_client = mock.MagicMock()
     mock_client.send.return_value = 400, 'failed'
     from_addr, to_addr = fake_email(), fake_email()
     subject = fake.bs()
     message = fake.text()
     ret = _send_with_sendgrid(
         from_addr=from_addr,
         to_addr=to_addr,
         subject=subject,
         message=message,
         mimetype='html',
         client=mock_client
     )
     assert_false(ret)
开发者ID:erinspace,项目名称:osf.io,代码行数:15,代码来源:test_email.py


示例9: test_cannot_bulk_create_children_on_a_registration

    def test_cannot_bulk_create_children_on_a_registration(self):
        registration = RegistrationFactory(project=self.project, creator=self.user)
        url = '/{}nodes/{}/children/'.format(API_BASE, registration._id)
        res = self.app.post_json_api(url, {
            'data': [self.child_two, {
                'type': 'nodes',
                'attributes': {
                    'title': fake.catch_phrase(),
                    'description': fake.bs(),
                    'category': 'project',
                    'public': True,
                }
            }]
        }, auth=self.user.auth, expect_errors=True, bulk=True)
        assert_equal(res.status_code, 404)

        self.project.reload()
        assert_equal(len(self.project.nodes), 0)
开发者ID:545zhou,项目名称:osf.io,代码行数:18,代码来源:test_node_children_list.py


示例10: test_cannot_update_a_withdrawn_registration

 def test_cannot_update_a_withdrawn_registration(self):
     url = '/{}registrations/{}/'.format(API_BASE, self.registration._id)
     res = self.app.put_json_api(url, {
         'data': {
             'id': self.registration._id,
             'type': 'nodes',
             'attributes': {
                 'title': fake.catch_phrase(),
                 'description': fake.bs(),
                 'category': 'hypothesis',
                 'public': True
             }
         }
     }, auth=self.user.auth, expect_errors=True)
     self.registration.reload()
     assert_equal(res.status_code, 405)
     assert_equal(self.registration.title, self.registration.title)
     assert_equal(self.registration.description, self.registration.description)
开发者ID:HalcyonChimera,项目名称:osf.io,代码行数:18,代码来源:test_withdrawn_registrations.py


示例11: test_project_wiki_edit_post_with_new_wname_and_content

    def test_project_wiki_edit_post_with_new_wname_and_content(self):
        page_name, page_content = fake.catch_phrase(), fake.bs()

        old_wiki_page_count = NodeWikiPage.find().count()
        url = self.project.web_url_for('project_wiki_edit_post', wname=page_name)
        # User submits to edit form with no content
        res = self.app.post(url, {'content': page_content}, auth=self.user.auth).follow()
        assert_equal(res.status_code, 200)

        new_wiki_page_count = NodeWikiPage.find().count()
        # A new wiki page was created in the db
        assert_equal(new_wiki_page_count, old_wiki_page_count + 1)

        # Node now has the new wiki page associated with it
        self.project.reload()
        new_page = self.project.get_wiki_page(page_name)
        assert_is_not_none(new_page)
        # content was set
        assert_equal(new_page.content, page_content)
开发者ID:AndrewSallans,项目名称:osf.io,代码行数:19,代码来源:test_wiki.py


示例12: test_cannot_update_a_retraction

 def test_cannot_update_a_retraction(self):
     registration = RegistrationFactory(creator=self.user, project=self.public_project)
     url = '/{}nodes/{}/'.format(API_BASE, registration._id)
     retraction = RetractedRegistrationFactory(registration=registration, user=registration.creator)
     res = self.app.put_json_api(url, {
         'data': {
             'id': registration._id,
             'type': 'nodes',
             'attributes': {
                 'title': fake.catch_phrase(),
                 'description': fake.bs(),
                 'category': 'hypothesis',
                 'public': True
             }
         }
     }, auth=self.user.auth, expect_errors=True)
     registration.reload()
     assert_equal(res.status_code, 404)
     assert_equal(registration.title, registration.title)
     assert_equal(registration.description, registration.description)
开发者ID:mauromsl,项目名称:osf.io,代码行数:20,代码来源:test_node_detail.py


示例13: make_comment

def make_comment():
    return Comment(id=fake.random_int(), body=fake.bs())
开发者ID:rmoorman,项目名称:marshmallow-jsonapi,代码行数:2,代码来源:conftest.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python fake.email函数代码示例发布时间:2022-05-27
下一篇:
Python base.TestWSGIController类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap