Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
141 lines (106 loc) · 3.53 KB

File metadata and controls

141 lines (106 loc) · 3.53 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
"""
>>> from hamcrest import assert_that
>>> from hamcrest import is_not
>>> testcases = {
... 'ideal_case': {
... 'name': 'ideal_case',
... 'parentIds': ['gid-1', 'gid-2'],
... 'steps': [
... {'name': 'step_one'}
... ]
... },
... 'like_ideal_case_by_group': {
... 'name': 'like_ideal_case_by_group',
... 'parentIds': ['gid-1', 'gid-2'],
... },
... 'has_wrong_group_case': {
... 'name': 'anoher_case',
... 'parentIds': ['gid-1', 'gid-3'],
... }
... }
>>> testgroups = {
... 'gid-1': {
... 'id': 'gid-1',
... 'befores': [
... {'name': 'before_#1_gid1'},
... {'name': 'before_#2_gid1'}
... ]
... },
... 'gid-2': {
... 'id': 'gid-2'
... }
... }
>>> assert_that(testcases['ideal_case'], has_step('step_one'))
>>> assert_that(testcases['ideal_case'],
... has_step('ideal_case'),
... is_not(has_step('step_one'))
... ) # doctest: +ELLIPSIS
Traceback (most recent call last):
...
AssertionError: ...
Expected: ...
but: ...
<BLANKLINE>
>>> assert_that(testcases['ideal_case'],
... has_step('wrong_step_name')
... ) # doctest: +ELLIPSIS
Traceback (most recent call last):
...
AssertionError: ...
Expected: ...
but: ...
<BLANKLINE>
"""
from hamcrest import all_of, anything
from hamcrest import equal_to, not_none
from hamcrest import has_entry, has_item
from hamcrest import contains_string
def has_step(name, *matchers):
return has_entry('steps',
has_item(
all_of(
has_entry('name', equal_to(name)),
*matchers
)
))
def has_parameter(name, value):
return has_entry('parameters',
has_item(
all_of(
has_entry('name', equal_to(name)),
has_entry('value', equal_to(value))
)
))
def has_link(url, link_type=None, name=None):
return has_entry('links',
has_item(
all_of(
*[has_entry(key, value) for key, value in
zip(('url', 'type', 'name'), (url, link_type, name)) if value is not None]
)
))
def has_issue_link(url, name=None):
return has_link(url, link_type='issue', name=name)
def has_test_case_link(url, name=None):
return has_link(url, link_type='test_case', name=name)
def has_attachment(attach_type=None, name=None):
return has_entry('attachments',
has_item(
all_of(
has_entry('source', anything()),
has_entry('type', attach_type) if attach_type else anything(),
has_entry('name', name) if name else anything()
)
))
def with_id():
return has_entry('uuid', not_none())
def with_status(status):
return has_entry('status', status)
def has_status_details(*matchers):
return has_entry('statusDetails', all_of(*matchers))
def with_status_message(message):
return has_entry('message', contains_string(message))
def has_history_id():
return has_entry('historyId', anything())
def has_description(*matchers):
return has_entry('description', all_of(*matchers))
Morty Proxy This is a proxified and sanitized view of the page, visit original site.