grappa-py / http Goto Github PK
View Code? Open in Web Editor NEWHTTP assertion plugin for grappa
Home Page: http://grappa-http.rtfd.io
License: MIT License
HTTP assertion plugin for grappa
Home Page: http://grappa-http.rtfd.io
License: MIT License
res | should.have.cookie('name').equal.to('foo')
res | should.have.cookie('name').that.should.expire.before('1 day')
grappa_http.add_adapter(CustomAdapter)
res | should.be.ok
res | should.be.error
res | should.be.bad_request
res | should.have.status(200)
res | should.be.xml
res | should.be.json
res | should.be.content('json')
res | should.be.content('application/json')
res | should.have.header('Server')
res | should.have.header.present('Server')
Trying to assert a dictionary to not contain keys from a list of keys
data | should.not_have.key(key)
is throwing AssertionError
`test_ddt.py:19: in _runtestmodule
matchrsi(cfg.result[0], data)
......\modules\matchrsi.py:32: in matchrsi
data | should.not_have.key(key)
C:\Program Files\Python37\lib\site-packages\grappa\test.py:208: in ror
return self.overload(value)
C:\Program Files\Python37\lib\site-packages\grappa\test.py:196: in overload
return self.call(subject, overload=True)
C:\Program Files\Python37\lib\site-packages\grappa\test.py:73: in call
return self._trigger() if overload else Test(subject)
self = <grappa.test.Test object at 0x0000026784443C88>
def _trigger(self):
"""
Trigger assertions in the current test engine.
Raises:
AssertionError: in case of assertion error.
Exception: in case of any other assertion error.
"""
log.debug('[test] trigger with context: {}'.format(self._ctx))
try:
err = self._engine.run(self._ctx)
except Exception as _err:
err = _err
finally:
# Important: reset engine state to defaults
self._engine.reset()
self._root._engine.reset()
# If error is present, raise it!
if err:
raise err
E AssertionError: Oops! Something went wrong!
E
E The following assertion was not satisfied
E subject "{'id': 'de83e969-504 ..." should not have key "restrictionReason"
E
E Where
E File "D:\workspace\isswtest\issw-functest\modules\matchrsi.py", line 32, in matchrsi
E
E 24| empty_attr = [k for k, v in rsi.Attributes.items() if v is None]
E 25| nonempty_attr = [k for k, v in rsi.Attributes.items() if v is not None]
E 26| else:
E 27| empty_attr = nonempty_attr = []
E 28|
E 29| if rsi.object_exist:
E 30| is_xobject(data)
E 31| for key in empty_attr:
E 32| > data | should.not_have.key(key)
E 33| list(data.keys()) | should.do_not.contain(key)
E 34|
E 35| for key in nonempty_attr:
E 36| data | should.have.key(key)
E 37| data.get(key) | should.be.equal.to(rsi.Attributes.get(key))
E 38| else:
E 39| # RSI Object does not exist
C:\Program Files\Python37\lib\site-packages\grappa\test.py:113: AssertionError`
Alternatively using
list(data.keys()) | should.do_not.contain(key)
is working though
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.