问题请教一下,一段代码不知道是啥意思
import atexitimport unittest
from pact import Consumer, Provider
pact = Consumer('Consumer').has_pact_with(Provider('Provider'))
pact.start_service()
atexit.register(pact.stop_service)
class GetUserInfoContract(unittest.TestCase):
def test_get_user(self):
expected = {
'username': 'UserA',
'id': 123,
'groups': ['Editors']
}
(pact
.given('UserA exists and is not an administrator')
.upon_receiving('a request for UserA')
.with_request('get', '/users/UserA')
.will_respond_with(200, body=expected))
with pact:
result = user('UserA')
self.assertEqual(result, expected)
(pact
.given('UserA exists and is not an administrator')
.upon_receiving('a request for UserA')
.with_request('get', '/users/UserA')
.will_respond_with(200, body=expected))上面那一段是什么个用法,请教一下
链式调用, PO模式常见的断言形式。 链式调用, PO模式常见的断言形式。
依次找到主脉络,发现问题
页:
[1]