本文整理汇总了Python中pitz.project.Project.matches_dict方法的典型用法代码示例。如果您正苦于以下问题:Python Project.matches_dict方法的具体用法?Python Project.matches_dict怎么用?Python Project.matches_dict使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pitz.project.Project
的用法示例。
在下文中一共展示了Project.matches_dict方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestWebApp
# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import matches_dict [as 别名]
class TestWebApp(unittest.TestCase):
def setUp(self):
self.p = Project(title='Bogus project for testing webapp')
c = Entity(self.p, title="c")
Entity(self.p, title="t")
matt = Person(self.p, title='matt')
self.webapp = webapp.SimpleWSGIApp(self.p)
self.webapp.handlers.append(handlers.HelpHandler(self.p))
Status(self.p, title='bogus status')
Estimate(self.p, title='bogus estimate')
Milestone(self.p, title='bogus milestone')
Tag(self.p, title='bogus tag')
Task(self.p, title='bogus task')
Component(self.p, title='bogus component')
Comment(
self.p,
title='bogus comment',
who_said_it=matt,
entity=c)
Activity(
self.p,
title='bogus activity',
who_did_it=matt, entity=c)
def tearDown(self):
for e in self.p:
e.self_destruct(self.p)
if os.path.exists('/tmp/project.pickle'):
os.remove('/tmp/project.pickle')
def mk_request(self, pi, qs, ha, expected_status,
expected_results=None):
bogus_environ = dict(
PATH_INFO=pi,
QUERY_STRING=qs,
HTTP_ACCEPT=ha)
wsgiref.util.setup_testing_defaults(bogus_environ)
bogus_start_response = mock.Mock()
results = self.webapp(bogus_environ, bogus_start_response)
assert bogus_start_response.called
assert bogus_start_response.call_args[0][0] == expected_status
if expected_results:
assert results == [expected_results], results
return results
def test_1(self):
self.mk_request('/', '', 'text/plain', '200 OK',
self.p.detailed_view)
def test_2(self):
self.mk_request('/', 'title=c', 'text/plain',
'200 OK',
self.p.matches_dict(title='c').detailed_view)
def test_3(self):
self.mk_request('/', 'title=c&title=t', 'text/plain',
'200 OK',
self.p.matches_dict(title=['c', 't']).detailed_view)
def test_4(self):
self.mk_request('/', 'title=c&title=t', 'application/x-pitz',
'200 OK',
self.p.matches_dict(title=['c', 't']).colorized_detailed_view)
def test_5(self):
self.mk_request('/Entity/by_title/c', '', 'text/plain',
'200 OK',
str(Entity.by_title('c')))
def test_6(self):
self.mk_request('/Task/all/detailed_view', 'status=unstarted',
'text/plain',
'200 OK',
Task.all().matches_dict(
status=['unstarted']).detailed_view)
def test_7(self):
self.mk_request('/Person/by_title/matt/my_todo', '',
'text/plain',
'200 OK',
Person.by_title('matt').my_todo.detailed_view)
def test_8(self):
self.mk_request('/Person/by_title/matt/my_todo/summarized_view',
'', 'text/plain',
'200 OK',
#.........这里部分代码省略.........