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

Python tests.create_project函数代码示例

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

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



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

示例1: test_distro

    def test_distro(self):
        """ Test the distro function. """
        create_distro(self.session)
        create_project(self.session)

        output = self.app.get('/distro/Fedora/')
        self.assertEqual(output.status_code, 200)

        expected = """
  <blockquote>
      Oups this is embarrassing, it seems that no projects are being
      monitored currently.
  </blockquote>"""
        self.assertTrue(expected in output.data)
        self.assertTrue(
            'form action="/distro/Fedora/search/" role="form">'
            in output.data)
        self.assertTrue(
            '<h1>Projects of Fedora monitored</h1>' in output.data)

        output = self.app.get('/distro/Fedora/?page=ab')
        self.assertEqual(output.status_code, 200)
        self.assertTrue(expected in output.data)
        self.assertTrue(
            'form action="/distro/Fedora/search/" role="form">'
            in output.data)
        self.assertTrue(
            '<h1>Projects of Fedora monitored</h1>' in output.data)
开发者ID:piotr1212,项目名称:anitya,代码行数:28,代码来源:test_flask.py


示例2: test_projects_search

    def test_projects_search(self):
        """ Test the projects_search function. """
        create_distro(self.session)
        create_project(self.session)

        output = self.app.get('/projects/search/g')
        self.assertEqual(output.status_code, 200)

        expected = """
                  <a href="http://www.geany.org/" target="_blank">
                    http://www.geany.org/
                  </a>"""
        self.assertTrue(expected in output.data)

        self.assertEqual(output.data.count('<a href="/project/'), 1)

        output = self.app.get('/projects/search/?page=ab')
        self.assertEqual(output.status_code, 200)
        self.assertTrue(expected in output.data)
        self.assertEqual(output.data.count('<a href="/project/'), 3)

        output = self.app.get(
            '/projects/search/geany*', follow_redirects=True)
        self.assertEqual(output.status_code, 200)

        expected = '<li class="message">Only one result matching with an '\
            'exact match, redirecting</li>'
        self.assertTrue(expected in output.data)
开发者ID:cicku,项目名称:anitya,代码行数:28,代码来源:test_flask.py


示例3: test_distro_repr

    def test_distro_repr(self):
        """ Test the __repr__ function of Project. """
        create_project(self.session)

        obs = '<Project(geany, http://www.geany.org/)>'
        project = model.Project.by_id(self.session, 1)
        self.assertEqual(str(project), obs)
开发者ID:Prashant-Surya,项目名称:anitya,代码行数:7,代码来源:test_project.py


示例4: test_log_search

    def test_log_search(self):
        """ Test the Log.search function. """
        create_project(self.session)

        logs = model.Log.search(self.session)
        self.assertEqual(len(logs), 3)
        self.assertEqual(
            logs[0].description,
            '[email protected] added project: R2spec')
        self.assertEqual(
            logs[1].description,
            '[email protected] added project: subsurface')
        self.assertEqual(
            logs[2].description,
            '[email protected] added project: geany')

        logs = model.Log.search(self.session, count=True)
        self.assertEqual(logs, 3)

        from_date = datetime.datetime.utcnow().date() - datetime.timedelta(days=1)
        logs = model.Log.search(
            self.session, from_date=from_date, offset=1, limit=1)
        self.assertEqual(len(logs), 1)
        self.assertEqual(
            logs[0].description,
            '[email protected] added project: subsurface')

        logs = model.Log.search(self.session, project_name='subsurface')
        self.assertEqual(len(logs), 1)
        self.assertEqual(
            logs[0].description,
            '[email protected] added project: subsurface')
开发者ID:ncoghlan,项目名称:anitya,代码行数:32,代码来源:test_model.py


示例5: test_projects

    def test_projects(self):
        """ Test the projects function. """
        create_distro(self.session)
        create_project(self.session)

        output = self.app.get('/projects/')
        self.assertEqual(output.status_code, 200)

        expected = """
                <a href="http://www.geany.org/" target="_blank">
                  http://www.geany.org/
                </a>"""
        self.assertTrue(expected in output.data)

        expected = """
                <a href="https://fedorahosted.org/r2spec/" target="_blank">
                  https://fedorahosted.org/r2spec/
                </a>"""
        self.assertTrue(expected in output.data)

        expected = """
                <a href="http://subsurface.hohndel.org/" target="_blank">
                  http://subsurface.hohndel.org/
                </a>"""
        self.assertTrue(expected in output.data)

        self.assertEqual(output.data.count('<a href="/project/'), 3)

        output = self.app.get('/projects/?page=ab')
        self.assertEqual(output.status_code, 200)
        self.assertEqual(output.data.count('<a href="/project/'), 3)
开发者ID:cicku,项目名称:anitya,代码行数:31,代码来源:test_flask.py


示例6: test_packages__repr__

    def test_packages__repr__(self):
        """ Test the Packages.__repr__ function. """
        create_project(self.session)
        create_distro(self.session)
        create_package(self.session)

        pkg = model.Packages.by_id(self.session, 1)
        self.assertEqual(str(pkg), '<Packages(1, Fedora: geany)>')
开发者ID:ncoghlan,项目名称:anitya,代码行数:8,代码来源:test_model.py


示例7: test_init_project

    def test_init_project(self):
        """ Test the __init__ function of Project. """
        create_project(self.session)
        self.assertEqual(3, model.Project.all(self.session, count=True))

        projects = model.Project.all(self.session)
        self.assertEqual(projects[0].name, 'geany')
        self.assertEqual(projects[1].name, 'R2spec')
        self.assertEqual(projects[2].name, 'subsurface')
开发者ID:ncoghlan,项目名称:anitya,代码行数:9,代码来源:test_model.py


示例8: test_packages_by_id

    def test_packages_by_id(self):
        """ Test the Packages.by_id function. """
        create_project(self.session)
        create_distro(self.session)
        create_package(self.session)

        pkg = model.Packages.by_id(self.session, 1)
        self.assertEqual(pkg.package_name, 'geany')
        self.assertEqual(pkg.distro, 'Fedora')
开发者ID:ncoghlan,项目名称:anitya,代码行数:9,代码来源:test_model.py


示例9: test_project_by_name

    def test_project_by_name(self):
        """ Test the by_name function of Project. """
        create_project(self.session)

        project = model.Project.by_name(self.session, 'geany')
        self.assertEqual(project[0].name, 'geany')
        self.assertEqual(project[0].homepage, 'http://www.geany.org/')

        project = model.Project.by_name(self.session, 'terminal')
        self.assertEqual(project, [])
开发者ID:Prashant-Surya,项目名称:anitya,代码行数:10,代码来源:test_project.py


示例10: test_project_search

    def test_project_search(self):
        """ Test the search function of Project. """
        create_project(self.session)

        projects = model.Project.search(self.session, 'gea')
        self.assertEqual(projects, [])

        projects = model.Project.search(self.session, 'gea*')
        self.assertEqual(projects[0].name, 'geany')
        self.assertEqual(projects[0].homepage, 'http://www.geany.org/')
开发者ID:Prashant-Surya,项目名称:anitya,代码行数:10,代码来源:test_project.py


示例11: test_project_search

    def test_project_search(self):
        """ Test the Project.search function. """
        create_project(self.session)

        projects = model.Project.search(self.session, '*', count=True)
        self.assertEqual(projects, 3)

        projects = model.Project.search(self.session, '*', page=2)
        self.assertEqual(len(projects), 0)

        projects = model.Project.search(self.session, '*', page='asd')
        self.assertEqual(len(projects), 3)
开发者ID:ncoghlan,项目名称:anitya,代码行数:12,代码来源:test_model.py


示例12: test_api_get_project_distro

    def test_api_get_project_distro(self):
        """ Test the api_get_project_distro function of the API. """
        create_distro(self.session)
        output = self.app.get('/api/project/Fedora/geany')
        self.assertEqual(output.status_code, 404)
        data = json.loads(output.data)

        exp = {
            "error": "No package \"geany\" found in distro \"Fedora\"",
            "output": "notok"
        }
        self.assertEqual(data, exp)

        create_project(self.session)
        create_package(self.session)

        output = self.app.get('/api/project/Fedora/gnome-terminal/')
        self.assertEqual(output.status_code, 404)
        data = json.loads(output.data)

        exp = {
            "error": "No package \"gnome-terminal\" found in distro "
                     "\"Fedora\"",
            "output": "notok"
        }
        self.assertEqual(data, exp)

        output = self.app.get('/api/project/Fedora/geany/')
        self.assertEqual(output.status_code, 200)
        data = json.loads(output.data)

        del(data['created_on'])
        del(data['updated_on'])

        exp = {
            "id": 1,
            "backend": "custom",
            "homepage": "http://www.geany.org/",
            "name": "geany",
            "regex": 'DEFAULT',
            "version": None,
            "version_url": 'http://www.geany.org/Download/Releases',
            "versions": [],
            "packages": [
                {
                  "distro": "Fedora",
                  "package_name": "geany"
                }
            ],
        }

        self.assertEqual(data, exp)
开发者ID:Prashant-Surya,项目名称:anitya,代码行数:52,代码来源:test_flask_api.py


示例13: test_project_all

    def test_project_all(self):
        """ Test the all function of Project. """
        create_project(self.session)

        projects = model.Project.all(self.session)
        self.assertEqual(projects[0].name, 'geany')
        self.assertEqual(projects[0].homepage, 'http://www.geany.org/')
        self.assertEqual(projects[1].name, 'R2spec')
        self.assertEqual(
            projects[1].homepage, 'https://fedorahosted.org/r2spec/')

        projects = model.Project.all(self.session, page=3)
        self.assertEqual(projects, [])
开发者ID:Prashant-Surya,项目名称:anitya,代码行数:13,代码来源:test_project.py


示例14: test_distros

    def test_distros(self):
        """ Test the distros function. """
        create_distro(self.session)
        create_project(self.session)

        output = self.app.get('/distros/')
        self.assertEqual(output.status_code, 200)

        expected = "Here is the list of all the distributions"
        self.assertTrue(expected in output.data)

        output = self.app.get('/distros/?page=ab')
        self.assertEqual(output.status_code, 200)
        self.assertTrue(expected in output.data)
开发者ID:piotr1212,项目名称:anitya,代码行数:14,代码来源:test_flask.py


示例15: test_project

    def test_project(self):
        """ Test the project function. """
        create_distro(self.session)
        create_project(self.session)

        output = self.app.get('/project/1/')
        self.assertEqual(output.status_code, 200)

        expected = """
            <p><a property="doap:homepage" href="http://www.geany.org/"
               target="_blank">http://www.geany.org/
             </a><p>"""

        self.assertTrue(expected in output.data)

        output = self.app.get('/project/10/')
        self.assertEqual(output.status_code, 404)
开发者ID:cicku,项目名称:anitya,代码行数:17,代码来源:test_flask.py


示例16: test_api_packages_wiki_list

    def test_api_packages_wiki_list(self):
        """ Test the api_packages_wiki_list function of the API. """
        create_distro(self.session)
        output = self.app.get('/api/packages/wiki/')
        self.assertEqual(output.status_code, 200)

        self.assertEqual(output.data, '')

        create_project(self.session)
        create_package(self.session)

        output = self.app.get('/api/packages/wiki/')
        self.assertEqual(output.status_code, 200)

        exp = "* geany DEFAULT http://www.geany.org/Download/Releases\n"\
            "* subsurface DEFAULT http://subsurface.hohndel.org/downloads/"
        self.assertEqual(output.data, exp)
开发者ID:Prashant-Surya,项目名称:anitya,代码行数:17,代码来源:test_flask_api.py


示例17: test_edit_project

    def test_edit_project(self):
        """ Test the edit_project function of Distro. """
        create_distro(self.session)
        create_project(self.session)

        project_objs = anitya.lib.model.Project.all(self.session)
        self.assertEqual(len(project_objs), 3)
        self.assertEqual(project_objs[0].name, 'geany')
        self.assertEqual(project_objs[0].homepage, 'http://www.geany.org/')
        self.assertEqual(project_objs[1].name, 'R2spec')
        self.assertEqual(project_objs[2].name, 'subsurface')

        anitya.lib.edit_project(
            self.session,
            project=project_objs[0],
            name=project_objs[0].name,
            homepage='http://www.geany.org',
            backend='PyPI',
            version_url=None,
            version_prefix=None,
            regex=None,
            insecure=False,
            user_id='[email protected]')

        project_objs = anitya.lib.model.Project.all(self.session)
        self.assertEqual(len(project_objs), 3)
        self.assertEqual(project_objs[0].name, 'geany')
        self.assertEqual(project_objs[0].homepage, 'http://www.geany.org')
        self.assertEqual(project_objs[1].name, 'R2spec')
        self.assertEqual(project_objs[2].name, 'subsurface')

        self.assertRaises(
            AnityaException,
            anitya.lib.edit_project,
            self.session,
            project=project_objs[2],
            name='geany',
            homepage='http://www.geany.org',
            backend=project_objs[2].backend,
            version_url=project_objs[2].version_url,
            version_prefix=None,
            regex=project_objs[2].regex,
            insecure=False,
            user_id='[email protected]',
        )
开发者ID:ncoghlan,项目名称:anitya,代码行数:45,代码来源:test_anityalib.py


示例18: test_distros

    def test_distros(self):
        """ Test the distros function. """
        create_distro(self.session)
        create_project(self.session)

        output = self.app.get('/distros/')
        self.assertEqual(output.status_code, 200)

        expected = """
  <p>
    Here is the list of all the distribution having at least one project
    mapped as a package of this distribution and monitored by anitya.
  </p>"""
        self.assertTrue(expected in output.data)

        output = self.app.get('/distros/?page=ab')
        self.assertEqual(output.status_code, 200)
        self.assertTrue(expected in output.data)
开发者ID:cicku,项目名称:anitya,代码行数:18,代码来源:test_flask.py


示例19: test_project_by_homepage

    def test_project_by_homepage(self):
        """ Test the by_homepage function of Project. """
        create_project(self.session)

        projects = model.Project.by_homepage(
            self.session, 'http://www.geany.org/')
        self.assertEqual(len(projects), 1)
        self.assertEqual(projects[0].name, 'geany')
        self.assertEqual(projects[0].homepage, 'http://www.geany.org/')

        projects = model.Project.by_homepage(
            self.session, 'http://subsurface.hohndel.org/')
        self.assertEqual(len(projects), 1)
        self.assertEqual(projects[0].name, 'subsurface')
        self.assertEqual(projects[0].homepage, 'http://subsurface.hohndel.org/')

        project = model.Project.by_homepage(self.session, 'terminal')
        self.assertEqual(project, [])
开发者ID:Prashant-Surya,项目名称:anitya,代码行数:18,代码来源:test_project.py


示例20: test_api_get_project

    def test_api_get_project(self):
        """ Test the api_get_project function of the API. """
        create_distro(self.session)
        output = self.app.get('/api/project/')
        self.assertEqual(output.status_code, 404)

        output = self.app.get('/api/project/10')
        self.assertEqual(output.status_code, 404)
        data = _read_json(output)

        exp = {"error": "no such project", "output": "notok"}
        self.assertEqual(data, exp)

        create_project(self.session)
        create_package(self.session)

        output = self.app.get('/api/project/10')
        self.assertEqual(output.status_code, 404)

        output = self.app.get('/api/project/1')
        self.assertEqual(output.status_code, 200)
        data = _read_json(output)

        del(data['created_on'])
        del(data['updated_on'])

        exp = {
            "id": 1,
            "backend": "custom",
            "homepage": "http://www.geany.org/",
            "name": "geany",
            "regex": 'DEFAULT',
            "version": None,
            "version_url": 'http://www.geany.org/Download/Releases',
            "versions": [],
            "packages": [
                {
                  "distro": "Fedora",
                  "package_name": "geany"
                }
            ],
        }

        self.assertEqual(exp, data)
开发者ID:souravbadami,项目名称:anitya,代码行数:44,代码来源:test_flask_api.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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