本文整理汇总了Python中tests.create_distro函数的典型用法代码示例。如果您正苦于以下问题:Python create_distro函数的具体用法?Python create_distro怎么用?Python create_distro使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_distro函数的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
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
示例16: 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
示例17: test_api_get_project_by_ecosystem
def test_api_get_project_by_ecosystem(self):
""" Test the api_get_project_ecosystem function of the API. """
create_distro(self.session)
output = self.app.get('/api/by_ecosystem/pypi/pypi_and_npm')
self.assertEqual(output.status_code, 404)
data = _read_json(output)
exp = {
"error": 'No project "pypi_and_npm" found in ecosystem "pypi"',
"output": "notok"
}
self.assertEqual(data, exp)
create_ecosystem_projects(self.session)
output = self.app.get('/api/by_ecosystem/pypi/not-a-project')
self.assertEqual(output.status_code, 404)
data = _read_json(output)
exp = {
"error": 'No project "not-a-project" found in ecosystem "pypi"',
"output": "notok"
}
self.assertEqual(data, exp)
output = self.app.get('/api/by_ecosystem/pypi/pypi_and_npm')
self.assertEqual(output.status_code, 200)
data = _read_json(output)
del(data['created_on'])
del(data['updated_on'])
exp = {
"id": 1,
"backend": "PyPI",
"homepage": "https://example.com/not-a-real-pypi-project",
"name": "pypi_and_npm",
"regex": None,
"version": None,
"version_url": None,
"versions": [],
"packages": [],
}
self.assertEqual(data, exp)
开发者ID:souravbadami,项目名称:anitya,代码行数:45,代码来源:test_flask_api.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_distro_search
def test_distro_search(self):
""" Test the Distro.search function. """
create_distro(self.session)
logs = model.Distro.search(self.session, '*', count=True)
self.assertEqual(logs, 2)
logs = model.Distro.search(self.session, 'Fed*')
self.assertEqual(len(logs), 1)
self.assertEqual(logs[0].name, 'Fedora')
logs = model.Distro.search(self.session, 'Fed*', page=1)
self.assertEqual(len(logs), 1)
self.assertEqual(logs[0].name, 'Fedora')
logs = model.Distro.search(self.session, 'Fed*', page='as')
self.assertEqual(len(logs), 1)
self.assertEqual(logs[0].name, 'Fedora')
开发者ID:ncoghlan,项目名称:anitya,代码行数:18,代码来源:test_model.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_distro函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论