def test_create_r():
""" tests the restful endpoint: create """
# get web app
test_app = start_web_app()
# test create
r = test_app.post('/create', params={'id': 'foo',
'interval': '60',
'filter': '',
'nic': 'eth1'},
headers={'Content-Type': 'application/json'})
assert r.status == 200
r = test_app.post('/create', params={'id': 'foo',
'interval': '60',
'iters': '1',
'filter': '',
'nic': 'eth1'},
headers={'Content-Type': 'application/json'})
assert r.status == 200
r = test_app.post('/create', params={})
assert r.status == 200
r = test_app.post('/create', params={'nic': 'eth1'})
assert r.status == 200
r = test_app.post('/create', params={'nic': 'eth1', 'id': 'foo'})
assert r.status == 200
r = test_app.post(
'/create', params={'nic': 'eth1', 'id': 'foo', 'interval': '61'})
assert r.status == 200
r = test_app.post('/create', params='{}')
assert r.status == 200
r = test_app.post('/create', params={'id': 'foo',
'interval': '60',
'filter': '',
'metadata': '{"foo": "bar"}',
'iters': '1',
'nic': 'eth1'},
headers={'Content-Type': 'application/json'})
assert r.status == 200
评论列表
文章目录