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


Python tests.create_distro函数代码示例

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


在下文中一共展示了create_distro函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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

    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

示例3: 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

示例4: test_create_project

    def test_create_project(self):
        """ Test the create_project function of Distro. """
        create_distro(self.session)
        self.assertEqual(2, model.Distro.all(self.session, count=True))

        anitya.lib.create_project(
            self.session,
            name='geany',
            homepage='http://www.geany.org/',
            version_url='http://www.geany.org/Download/Releases',
            regex='DEFAULT',
            user_mail='[email protected]',
        )

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

        self.assertRaises(
            AnityaException,
            anitya.lib.create_project,
            self.session,
            name='geany',
            homepage='http://www.geany.org/',
            version_url='http://www.geany.org/Download/Releases',
            regex='DEFAULT',
            user_mail='[email protected]',
        )

        project_objs = anitya.lib.model.Project.all(self.session)
        self.assertEqual(len(project_objs), 1)
        self.assertEqual(project_objs[0].name, 'geany')
        self.assertEqual(project_objs[0].homepage, 'http://www.geany.org/')
开发者ID:cicku,项目名称:anitya,代码行数:34,代码来源:test_anityalib.py

示例5: test_init_distro

    def test_init_distro(self):
        """ Test the __init__ function of Distro. """
        create_distro(self.session)
        self.assertEqual(2, model.Distro.all(self.session, count=True))

        distros = model.Distro.all(self.session)
        self.assertEqual(distros[0].name, 'Debian')
        self.assertEqual(distros[1].name, 'Fedora')
开发者ID:ncoghlan,项目名称:anitya,代码行数:8,代码来源:test_model.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_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

示例8: test_distro_all

    def test_distro_all(self):
        """ Test the all function of Distro. """
        create_distro(self.session)

        distro = model.Distro.all(self.session, page=2)
        self.assertEqual(distro, [])

        distro = model.Distro.all(self.session, page='b')
        distro2 = model.Distro.all(self.session)
        self.assertEqual(distro, distro2)
开发者ID:Prashant-Surya,项目名称:anitya,代码行数:10,代码来源:test_distro.py

示例9: test_distro_get_or_create

    def test_distro_get_or_create(self):
        """ Test the get_or_create function of Distro. """
        create_distro(self.session)

        distro = model.Distro.get_or_create(self.session, 'fedora')
        self.assertEqual(distro.name, 'Fedora')
        self.assertEqual(2, model.Distro.all(self.session, count=True))

        distro = model.Distro.get_or_create(self.session, 'CentOS')
        self.assertEqual(distro.name, 'CentOS')
        self.assertEqual(3, model.Distro.all(self.session, count=True))
开发者ID:Prashant-Surya,项目名称:anitya,代码行数:11,代码来源:test_distro.py

示例10: test_distro_search

    def test_distro_search(self):
        """ Test the search function of Distro. """
        create_distro(self.session)

        distro = model.Distro.search(self.session, 'fed')
        self.assertEqual(distro, [])

        distro = model.Distro.search(self.session, 'fed*')
        self.assertNotEqual(distro, [])
        self.assertEqual(distro[0].name, 'Fedora')
        self.assertEqual(len(distro), 1)
开发者ID:Prashant-Surya,项目名称:anitya,代码行数:11,代码来源:test_distro.py

示例11: 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

示例12: 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

示例13: test_distro_by_name

    def test_distro_by_name(self):
        """ Test the by_name function of Distro. """
        create_distro(self.session)

        distro = model.Distro.by_name(self.session, 'fedora')
        self.assertEqual(distro.name, 'Fedora')

        distro = model.Distro.get(self.session, 'fedora')
        self.assertEqual(distro.name, 'Fedora')

        distro = model.Distro.by_name(self.session, 'DEBIAN')
        self.assertEqual(distro.name, 'Debian')

        distro = model.Distro.get(self.session, 'DEBIAN')
        self.assertEqual(distro.name, 'Debian')
开发者ID:Prashant-Surya,项目名称:anitya,代码行数:15,代码来源:test_distro.py

示例14: 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

示例15: 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


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