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

Python urls.get_validate_diff_url函数代码示例

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

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



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

示例1: test_post_with_conflicting_repos

    def test_post_with_conflicting_repos(self):
        """Testing the POST validations/diffs/ API with conflicting
        repositories
        """
        repository = self.create_repository(tool_name='Test')
        self.create_repository(tool_name='Test',
                               name='Test 2',
                               path='blah',
                               mirror_path=repository.path)

        diff = SimpleUploadedFile('readme.diff', self.VALID_GIT_DIFF,
                                  content_type='text/x-patch')
        rsp = self.api_post(
            get_validate_diff_url(),
            {
                'repository': repository.path,
                'path': diff,
                'basedir': '/trunk',
            },
            expected_status=400)

        self.assertEqual(rsp['stat'], 'fail')
        self.assertEqual(rsp['err']['code'], INVALID_REPOSITORY.code)
        self.assertEqual(rsp['err']['msg'],
                         'Too many repositories matched "%s". Try '
                         'specifying the repository by name instead.'
                         % repository.path)
        self.assertEqual(rsp['repository'], repository.path)
开发者ID:chipx86,项目名称:reviewboard,代码行数:28,代码来源:test_validate_diff.py


示例2: test_post_with_base_commit_id

    def test_post_with_base_commit_id(self):
        """Testing the POST validation/diffs/ API with base_commit_id"""
        self.spy_on(DiffSet.objects.create_from_upload, call_original=True)

        repository = self.create_repository(tool_name='Test')

        diff_filename = os.path.join(os.path.dirname(scmtools.__file__),
                                     'testdata', 'git_readme.diff')
        f = open(diff_filename, "r")

        self.api_post(
            get_validate_diff_url(),
            {
                'repository': repository.pk,
                'path': f,
                'basedir': '/trunk',
                'base_commit_id': '1234',
            },
            expected_status=200,
            expected_mimetype=validate_diff_mimetype)

        f.close()

        last_call = DiffSet.objects.create_from_upload.last_call
        self.assertEqual(last_call.kwargs.get('base_commit_id'), '1234')
开发者ID:Anastasiya2307,项目名称:reviewboard,代码行数:25,代码来源:test_validate_diff.py


示例3: test_post

    def test_post(self):
        """Testing the POST validation/diffs/ API"""
        repository = self.create_repository(tool_name='Test')

        diff = SimpleUploadedFile('readme.diff', self.DEFAULT_GIT_README_DIFF,
                                  content_type='text/x-patch')

        self.api_post(
            get_validate_diff_url(),
            {
                'repository': repository.pk,
                'path': diff,
                'basedir': '/trunk',
            },
            expected_status=200,
            expected_mimetype=validate_diff_mimetype)
开发者ID:chipx86,项目名称:reviewboard,代码行数:16,代码来源:test_validate_diff.py


示例4: test_post_with_missing_basedir

    def test_post_with_missing_basedir(self):
        """Testing the POST validations/diffs/ API with a missing basedir"""
        repository = self.create_repository(tool_name='Test')

        diff = SimpleUploadedFile('readme.diff', self.DEFAULT_GIT_README_DIFF,
                                  content_type='text/x-patch')
        rsp = self.api_post(
            get_validate_diff_url(),
            {
                'repository': repository.pk,
                'path': diff,
            },
            expected_status=400)

        self.assertEqual(rsp['stat'], 'fail')
        self.assertEqual(rsp['err']['code'], INVALID_FORM_DATA.code)
        self.assertIn('basedir', rsp['fields'])
开发者ID:chipx86,项目名称:reviewboard,代码行数:17,代码来源:test_validate_diff.py


示例5: test_post_with_site_no_access

    def test_post_with_site_no_access(self):
        """Testing the POST validation/diffs/ API
        without access to a local site
        """
        repository = self.create_repository(with_local_site=True,
                                            tool_name='Test')

        diff = SimpleUploadedFile('readme.diff', self.DEFAULT_GIT_README_DIFF,
                                  content_type='text/x-patch')
        self.api_post(
            get_validate_diff_url(self.local_site_name),
            {
                'repository': repository.pk,
                'path': diff,
                'basedir': '/trunk',
            },
            expected_status=403)
开发者ID:chipx86,项目名称:reviewboard,代码行数:17,代码来源:test_validate_diff.py


示例6: test_post

    def test_post(self):
        """Testing the POST validation/diffs/ API"""
        repository = self.create_repository(tool_name='Test')

        diff_filename = os.path.join(os.path.dirname(scmtools.__file__),
                                     'testdata', 'git_readme.diff')
        f = open(diff_filename, "r")

        self.api_post(
            get_validate_diff_url(),
            {
                'repository': repository.pk,
                'path': f,
                'basedir': '/trunk',
            },
            expected_status=200,
            expected_mimetype=validate_diff_mimetype)

        f.close()
开发者ID:PingAnTech,项目名称:reviewboard,代码行数:19,代码来源:test_validate_diff.py


示例7: test_post_with_site_no_access

    def test_post_with_site_no_access(self):
        """Testing the POST validation/diffs/ API
        without access to a local site
        """
        repository = self.create_repository(with_local_site=True,
                                            tool_name='Test')

        diff_filename = os.path.join(os.path.dirname(scmtools.__file__),
                                     'testdata', 'git_readme.diff')

        with open(diff_filename, 'r') as fp:
            self.api_post(
                get_validate_diff_url(self.local_site_name),
                {
                    'repository': repository.pk,
                    'path': fp,
                    'basedir': '/trunk',
                },
                expected_status=403)
开发者ID:PingAnTech,项目名称:reviewboard,代码行数:19,代码来源:test_validate_diff.py


示例8: test_post_repository_private

    def test_post_repository_private(self):
        """Testing the POST <URL> API without access to the requested
        repository
        """
        repository = self.create_repository(tool_name='Test',
                                            public=False)

        rsp = self.api_post(
            get_validate_diff_url(),
            {
                'repository': repository.path,
                'path': SimpleUploadedFile('readme.diff', self.VALID_GIT_DIFF,
                                           content_type='text/x-patch'),
                'basedir': '/trunk',
            },
            expected_status=400)

        self.assertEqual(rsp['stat'], 'fail')
        self.assertEqual(rsp['err']['code'], INVALID_REPOSITORY.code)
开发者ID:chipx86,项目名称:reviewboard,代码行数:19,代码来源:test_validate_diff.py


示例9: test_post_with_missing_basedir

    def test_post_with_missing_basedir(self):
        """Testing the POST validations/diffs/ API with a missing basedir"""
        repository = self.create_repository(tool_name='Test')

        diff_filename = os.path.join(os.path.dirname(scmtools.__file__),
                                     'testdata', 'git_readme.diff')
        f = open(diff_filename, 'r')

        rsp = self.api_post(
            get_validate_diff_url(),
            {
                'repository': repository.pk,
                'path': f,
            },
            expected_status=400)
        f.close()

        self.assertEqual(rsp['stat'], 'fail')
        self.assertEqual(rsp['err']['code'], INVALID_FORM_DATA.code)
        self.assertIn('basedir', rsp['fields'])
开发者ID:PingAnTech,项目名称:reviewboard,代码行数:20,代码来源:test_validate_diff.py


示例10: test_post_diff_with_files_not_found

    def test_post_diff_with_files_not_found(self):
        """Testing the POST validation/diffs/ API with source files not found"""
        repository = self.create_repository(tool_name='Subversion')

        diff_filename = os.path.join(os.path.dirname(scmtools.__file__),
                                     'testdata', 'svn_file_not_found.diff')
        f = open(diff_filename, 'r')

        rsp = self.apiPost(
            get_validate_diff_url(),
            {
                'repository': repository.pk,
                'path': f,
                'basedir': '/trunk',
            },
            expected_status=400)
        f.close()

        self.assertEqual(rsp['stat'], 'fail')
        self.assertEqual(rsp['err']['code'], REPO_FILE_NOT_FOUND.code)
        self.assertEqual(rsp['file'], '/trunk/doc/misc-docs/Makefile2')
        self.assertEqual(rsp['revision'], '4')
开发者ID:harrifeng,项目名称:reviewboard,代码行数:22,代码来源:test_validate_diff.py


示例11: test_post_with_parse_error

    def test_post_with_parse_error(self):
        """Testing the POST validation/diffs/ API with a malformed diff file"""
        repository = self.create_repository(tool_name='Test')

        diff_filename = os.path.join(os.path.dirname(scmtools.__file__),
                                     'testdata', 'stunnel.pem')
        f = open(diff_filename, 'r')
        rsp = self.api_post(
            get_validate_diff_url(),
            {
                'repository': repository.pk,
                'path': f,
                'basedir': '/trunk',
            },
            expected_status=400)
        f.close()

        self.assertEqual(rsp['stat'], 'fail')
        self.assertEqual(rsp['err']['code'], DIFF_PARSE_ERROR.code)
        self.assertEqual(rsp['reason'],
                         'This does not appear to be a git diff')
        self.assertEqual(rsp['linenum'], 0)
开发者ID:PingAnTech,项目名称:reviewboard,代码行数:22,代码来源:test_validate_diff.py


示例12: test_post_with_base_commit_id

    def test_post_with_base_commit_id(self):
        """Testing the POST validation/diffs/ API with base_commit_id"""
        self.spy_on(DiffSet.objects.create_from_upload, call_original=True)

        repository = self.create_repository(tool_name='Test')

        diff = SimpleUploadedFile('readme.diff', self.DEFAULT_GIT_README_DIFF,
                                  content_type='text/x-patch')

        self.api_post(
            get_validate_diff_url(),
            {
                'repository': repository.pk,
                'path': diff,
                'basedir': '/trunk',
                'base_commit_id': '1234',
            },
            expected_status=200,
            expected_mimetype=validate_diff_mimetype)

        last_call = DiffSet.objects.create_from_upload.last_call
        self.assertEqual(last_call.kwargs.get('base_commit_id'), '1234')
开发者ID:chipx86,项目名称:reviewboard,代码行数:22,代码来源:test_validate_diff.py


示例13: test_post_with_files_not_found

    def test_post_with_files_not_found(self):
        """Testing the POST validation/diffs/ API
        with source files not found
        """
        repository = self.create_repository(tool_name='Test')

        diff = SimpleUploadedFile('readme.diff',
                                  self.DEFAULT_GIT_FILE_NOT_FOUND_DIFF,
                                  content_type='text/x-patch')
        rsp = self.api_post(
            get_validate_diff_url(),
            {
                'repository': repository.pk,
                'path': diff,
                'basedir': '',
            },
            expected_status=400)

        self.assertEqual(rsp['stat'], 'fail')
        self.assertEqual(rsp['err']['code'], REPO_FILE_NOT_FOUND.code)
        self.assertEqual(rsp['file'], 'missing-file')
        self.assertEqual(rsp['revision'], 'd6613f0')
开发者ID:chipx86,项目名称:reviewboard,代码行数:22,代码来源:test_validate_diff.py


示例14: test_post_diff_with_parse_error

    def test_post_diff_with_parse_error(self):
        """Testing the POST validation/diffs/ API with a malformed diff file"""
        # Post a git diff against the svn repository
        repository = self.create_repository(tool_name='Subversion')

        diff_filename = os.path.join(os.path.dirname(scmtools.__file__),
                                     'testdata', 'git_complex.diff')
        f = open(diff_filename, 'r')
        rsp = self.apiPost(
            get_validate_diff_url(),
            {
                'repository': repository.pk,
                'path': f,
                'basedir': '/trunk',
            },
            expected_status=400)
        f.close()

        self.assertEqual(rsp['stat'], 'fail')
        self.assertEqual(rsp['err']['code'], DIFF_PARSE_ERROR.code)
        self.assertEqual(
            rsp['reason'],
            'No valid separator after the filename was found in the diff header')
        self.assertEqual(rsp['linenum'], 2)
开发者ID:harrifeng,项目名称:reviewboard,代码行数:24,代码来源:test_validate_diff.py


示例15: test_get_with_site_no_access

 def test_get_with_site_no_access(self):
     """Testing the GET validation/diffs/ API
     without access to local site
     """
     self.api_get(get_validate_diff_url(self.local_site_name),
                  expected_status=403)
开发者ID:PingAnTech,项目名称:reviewboard,代码行数:6,代码来源:test_validate_diff.py


示例16: test_get_with_site

    def test_get_with_site(self):
        """Testing the GET validation/diffs/ API with access to local site"""
        self._login_user(local_site=True)

        self.api_get(get_validate_diff_url(self.local_site_name),
                     expected_mimetype=validate_diff_mimetype)
开发者ID:PingAnTech,项目名称:reviewboard,代码行数:6,代码来源:test_validate_diff.py


示例17: test_get

 def test_get(self):
     """Testing the GET validation/diffs/ API"""
     self.api_get(get_validate_diff_url(),
                  expected_mimetype=validate_diff_mimetype)
开发者ID:PingAnTech,项目名称:reviewboard,代码行数:4,代码来源:test_validate_diff.py


示例18: setup_http_not_allowed_item_test

 def setup_http_not_allowed_item_test(self, user):
     return get_validate_diff_url()
开发者ID:PingAnTech,项目名称:reviewboard,代码行数:2,代码来源:test_validate_diff.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python forms.ReviewFlagFormSet类代码示例发布时间:2022-05-26
下一篇:
Python urls.get_user_list_url函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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