本文整理汇总了Python中tests.create_project函数的典型用法代码示例。如果您正苦于以下问题:Python create_project函数的具体用法?Python create_project怎么用?Python create_project使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_project函数的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)
示例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)
示例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)
示例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')
示例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)
示例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)>')
示例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')
示例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')
示例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, [])
示例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/')
示例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)
示例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)
示例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, [])
示例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)
示例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)