"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/context/test_context.py" between
http-prompt-1.0.0.tar.gz and http-prompt-2.1.0.tar.gz

About: HTTP Prompt is an interactive command-line HTTP client featuring autocomplete and syntax highlighting.

test_context.py  (http-prompt-1.0.0):test_context.py  (http-prompt-2.1.0)
skipping to change at line 103 skipping to change at line 103
org_children = list(sorted(list(orgs_children)[0].children)) org_children = list(sorted(list(orgs_children)[0].children))
assert len(org_children) == 2 assert len(org_children) == 2
assert org_children[0].name == 'X-Foo' assert org_children[0].name == 'X-Foo'
assert org_children[1].name == 'featured' assert org_children[1].name == 'featured'
users_children = list(sorted(root_children[1].children)) users_children = list(sorted(root_children[1].children))
assert len(users_children) == 2 assert len(users_children) == 2
assert users_children[0].name == 'Accept' assert users_children[0].name == 'Accept'
assert users_children[1].name == 'since' assert users_children[1].name == 'since'
def test_override():
"""Parameters can be defined at path level
"""
c = Context('http://localhost', spec={
'paths': {
'/users': {
'parameters': [
{'name': 'username', 'in': 'query'},
{'name': 'Accept', 'in': 'header'}
],
'get': {
'parameters': [
{'name': 'custom1', 'in': 'query'}
]
},
'post': {
'parameters': [
{'name': 'custom2', 'in': 'query'},
]
},
},
'/orgs': {
'parameters': [
{'name': 'username', 'in': 'query'},
{'name': 'Accept', 'in': 'header'}
],
'get': {}
}
}
})
assert c.url == 'http://localhost'
root_children = list(sorted(c.root.children))
# one path
assert len(root_children) == 2
assert root_children[0].name == 'orgs'
assert root_children[1].name == 'users'
orgs_methods = list(sorted(list(root_children)[0].children))
# path parameters are used even if no method parameter
assert len(orgs_methods) == 2
assert next(filter(lambda i:i.name == 'username', orgs_methods), None) is no
t None
assert next(filter(lambda i:i.name == 'Accept', orgs_methods), None) is not
None
users_methods = list(sorted(list(root_children)[1].children))
# path and methods parameters are merged
assert len(users_methods) == 4
assert next(filter(lambda i:i.name == 'username', users_methods), None) is n
ot None
assert next(filter(lambda i:i.name == 'custom1', users_methods), None) is no
t None
assert next(filter(lambda i:i.name == 'custom2', users_methods), None) is no
t None
assert next(filter(lambda i:i.name == 'Accept', users_methods), None) is not
None
 End of changes. 1 change blocks. 
0 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)