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

Python tests.json_response函数代码示例

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

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



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

示例1: test_wiki_page_refresh_by_title

 def test_wiki_page_refresh_by_title(self):
     self.response.json = json_response(responses['wiki_page']['get'])
     wiki_page = self.redmine.wiki_page.get('Foo', project_id=1)
     self.assertEqual(wiki_page.title, 'Foo')
     self.response.json = json_response({'wiki_page': {'title': 'Bar'}})
     wiki_page = wiki_page.refresh()
     self.assertEqual(wiki_page.title, 'Bar')
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例2: test_wiki_page_includes

 def test_wiki_page_includes(self):
     response_includes = responses['wiki_page']['get']
     self.response.json = json_response(response_includes)
     wiki_page = self.redmine.wiki_page.get('Foo', project_id=1)
     response_includes['wiki_page']['attachments'] = responses['attachment']['get']['attachment']
     self.response.json = json_response(response_includes)
     self.assertIsInstance(wiki_page.attachments, ResourceSet)
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例3: test_saving_existing_resource_updates_it

 def test_saving_existing_resource_updates_it(self):
     self.response.json = json_response(responses['project']['get'])
     project = self.redmine.project.get(1)
     project.name = 'Bar'
     self.assertEqual(project.save(), True)
     self.response.json = json_response({'project': {'id': 1, 'name': 'Bar'}})
     project = project.refresh()
     self.assertEqual(project.name, 'Bar')
开发者ID:chineping,项目名称:python-redmine,代码行数:8,代码来源:test_resources.py


示例4: test_can_refresh_itself

 def test_can_refresh_itself(self):
     self.response.json = json_response(responses['project']['get'])
     project = self.redmine.project.get(1)
     self.assertEqual(project.id, 1)
     self.assertEqual(project.name, 'Foo')
     self.response.json = json_response({'project': {'id': 2, 'name': 'Bar'}})
     project = project.refresh()
     self.assertEqual(project.id, 2)
     self.assertEqual(project.name, 'Bar')
开发者ID:chineping,项目名称:python-redmine,代码行数:9,代码来源:test_resources.py


示例5: test_project_includes

 def test_project_includes(self):
     response_includes = responses['project']['get']
     self.response.json = json_response(response_includes)
     project = self.redmine.project.get(1)
     response_includes['project'].update(responses['issue_category']['filter'])
     self.response.json = json_response(response_includes)
     self.assertIsInstance(project.issue_categories, ResourceSet)
     response_includes['project'].update(responses['tracker']['all'])
     self.response.json = json_response(response_includes)
     self.assertIsInstance(project.trackers, ResourceSet)
开发者ID:chineping,项目名称:python-redmine,代码行数:10,代码来源:test_resources.py


示例6: test_group_includes

 def test_group_includes(self):
     response_includes = responses['group']['get']
     self.response.json = json_response(response_includes)
     group = self.redmine.group.get(1)
     response_includes['group']['memberships'] = responses['project_membership']['filter']['memberships']
     self.response.json = json_response(response_includes)
     self.assertIsInstance(group.memberships, ResourceSet)
     response_includes['group']['users'] = responses['user']['all']['users']
     self.response.json = json_response(response_includes)
     self.assertIsInstance(group.users, ResourceSet)
开发者ID:chineping,项目名称:python-redmine,代码行数:10,代码来源:test_resources.py


示例7: test_enumeration_filter

 def test_enumeration_filter(self):
     self.response.json = json_response(responses['enumeration']['filter'])
     enumerations = self.redmine.enumeration.filter(resource='time_entry_activities')
     self.assertEqual(enumerations[0].id, 1)
     self.assertEqual(enumerations[0].name, 'Foo')
     self.assertEqual(enumerations[1].id, 2)
     self.assertEqual(enumerations[1].name, 'Bar')
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例8: test_time_entry_filter

 def test_time_entry_filter(self):
     self.response.json = json_response(responses['time_entry']['filter'])
     time_entries = self.redmine.time_entry.filter(issue_id=1)
     self.assertEqual(time_entries[0].id, 1)
     self.assertEqual(time_entries[0].hours, 3)
     self.assertEqual(time_entries[1].id, 2)
     self.assertEqual(time_entries[1].hours, 4)
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例9: test_time_entry_all

 def test_time_entry_all(self):
     self.response.json = json_response(responses['time_entry']['all'])
     time_entries = self.redmine.time_entry.all()
     self.assertEqual(time_entries[0].id, 1)
     self.assertEqual(time_entries[0].hours, 3)
     self.assertEqual(time_entries[1].id, 2)
     self.assertEqual(time_entries[1].hours, 4)
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例10: test_issue_version_can_be_retrieved_via_version_attribute

 def test_issue_version_can_be_retrieved_via_version_attribute(self):
     from redmine.resources import Version
     self.response.json = json_response(
         {'issue': {'subject': 'Foo', 'id': 1, 'fixed_version': {'id': 1, 'name': 'Foo'}}}
     )
     issue = self.redmine.issue.get(1)
     self.assertIsInstance(issue.version, Version)
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例11: test_news_all

 def test_news_all(self):
     self.response.json = json_response(responses['news']['all'])
     news = self.redmine.news.all()
     self.assertEqual(news[0].id, 1)
     self.assertEqual(news[0].title, 'Foo')
     self.assertEqual(news[1].id, 2)
     self.assertEqual(news[1].title, 'Bar')
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例12: test_version_filter

 def test_version_filter(self):
     self.response.json = json_response(responses['version']['filter'])
     versions = self.redmine.version.filter(project_id=1)
     self.assertEqual(versions[0].id, 1)
     self.assertEqual(versions[0].name, 'Foo')
     self.assertEqual(versions[1].id, 2)
     self.assertEqual(versions[1].name, 'Bar')
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例13: test_custom_field_all

 def test_custom_field_all(self):
     self.response.json = json_response(responses['custom_field']['all'])
     fields = self.redmine.custom_field.all()
     self.assertEqual(fields[0].id, 1)
     self.assertEqual(fields[0].name, 'Foo')
     self.assertEqual(fields[1].id, 2)
     self.assertEqual(fields[1].name, 'Bar')
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例14: test_dir_returns_resource_attributes

 def test_dir_returns_resource_attributes(self):
     self.response.json = json_response(responses['issue']['get'])
     attributes = dir(self.redmine.issue.get(1))
     self.assertIn('id', attributes)
     self.assertIn('subject', attributes)
     self.assertIn('relations', attributes)
     self.assertIn('time_entries', attributes)
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例15: test_project_membership_update

 def test_project_membership_update(self):
     self.response.json = json_response(responses['project_membership']['get'])
     membership = self.redmine.project_membership.get(1)
     membership.role_ids = [1, 2]
     self.assertEqual(membership.save(), True)
     self.assertEqual(membership.roles[0].id, 1)
     self.assertEqual(membership.roles[1].id, 2)
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例16: test_issue_status_all

 def test_issue_status_all(self):
     self.response.json = json_response(responses['issue_status']['all'])
     statuses = self.redmine.issue_status.all()
     self.assertEqual(statuses[0].id, 1)
     self.assertEqual(statuses[0].name, 'Foo')
     self.assertEqual(statuses[1].id, 2)
     self.assertEqual(statuses[1].name, 'Bar')
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例17: test_tracker_all

 def test_tracker_all(self):
     self.response.json = json_response(responses['tracker']['all'])
     trackers = self.redmine.tracker.all()
     self.assertEqual(trackers[0].id, 1)
     self.assertEqual(trackers[0].name, 'Foo')
     self.assertEqual(trackers[1].id, 2)
     self.assertEqual(trackers[1].name, 'Bar')
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例18: test_saving_new_resource_creates_it

 def test_saving_new_resource_creates_it(self):
     self.response.status_code = 201
     self.response.json = json_response(responses['project']['get'])
     project = self.redmine.project.new()
     project.name = 'Foo'
     self.assertEqual(project.save(), True)
     self.assertEqual(project.id, 1)
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例19: test_news_filter

 def test_news_filter(self):
     self.response.json = json_response(responses['news']['filter'])
     news = self.redmine.news.filter(project_id=1)
     self.assertEqual(news[0].id, 1)
     self.assertEqual(news[0].title, 'Foo')
     self.assertEqual(news[1].id, 2)
     self.assertEqual(news[1].title, 'Bar')
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py


示例20: test_user_filter

 def test_user_filter(self):
     self.response.json = json_response(responses['user']['filter'])
     users = self.redmine.user.filter(status_id=2)
     self.assertEqual(users[0].id, 1)
     self.assertEqual(users[0].firstname, 'John')
     self.assertEqual(users[1].id, 2)
     self.assertEqual(users[1].firstname, 'Jack')
开发者ID:chineping,项目名称:python-redmine,代码行数:7,代码来源:test_resources.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python tests.locate函数代码示例发布时间:2022-05-27
下一篇:
Python tests.join_xml_data_path函数代码示例发布时间: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