def step_impl(context): reset_db() data['urn_to'] = 'internal.12344' data['urn_from'] = 'respondent.122342' context.response = app.test_client().post("http://localhost:5050/message/send", data=flask.json.dumps(data), headers=headers) msg_resp = json.loads(context.response.data) context.msg_id = msg_resp['msg_id'] modify_data['action'] = 'remove' modify_data['label'] = 'UNREAD' context.response = app.test_client().put(url.format(context.msg_id), data=flask.json.dumps(modify_data), headers=headers)
def _client(env): monkeypatch.setenv('FLASK_ENV', env) monkeypatch.setenv('APP_ENV', env) importlib.reload(sys.modules['app.application']) from app.application import app client = app.test_client() return client
def step_impl(context): data['urn_to'] = 'internal.12344' data['urn_from'] = 'respondent.122342' context.response = app.test_client().post("http://localhost:5050/message/send", data=flask.json.dumps(data), headers=headers) msg_resp = json.loads(context.response.data) context.msg_id = msg_resp['msg_id']
def step_impl(context): reset_db() for x in range(0, 2): data['msg_id'] = str(uuid.uuid4()) data['urn_to'] = 'respondent.122342' data['urn_from'] = 'internal.12344' context.response = app.test_client().post( "http://localhost:5050/message/send", data=flask.json.dumps(data), headers=headers)
def step_impl(context): context.post_draft = app.test_client().post("http://localhost:5050/draft/save", data=json.dumps(data), headers=headers) msg_resp = json.loads(context.post_draft.data) context.msg_id = msg_resp['msg_id'] context.message = {'msg_id': context.msg_id, 'urn_to': 'test', 'urn_from': 'respondent.test', 'subject': 'Hello World', 'body': 'Test', 'thread_id': '', 'collection_case': 'collection case1', 'reporting_unit': 'reporting case1', 'survey': 'survey'}
def client(monkeypatch): from app.application import app client = app.test_client() return client
def step_impl(context): context.response = app.test_client().post(url, data=json.dumps(data), headers=headers)
def step_impl(context): url = "http://localhost:5050/message/send" context.response = app.test_client().post(url, headers=headers)
def step_impl(context): headers['user_urn'] = 'internal.122342' context.response = app.test_client().get(url, headers=headers)
def step_impl(context): headers['user_urn'] = 'internal.12344' new_url = url + context.msg_id context.response = app.test_client().get(new_url, headers=headers)
def step_impl(context): new_url = url + str(uuid.uuid4()) context.response = app.test_client().get(new_url, headers=headers)
def step_impl(context): new_url = url + context.msg_id context.response = app.test_client().get(new_url, headers=headers)
def before_all(): """Setup for testing.""" world.app = app.test_client()
def step_impl(context): context.response = app.test_client().get("http://localhost:5050/message/{}".format(context.msg_id), data=flask.json.dumps(modify_data), headers=headers) response = flask.json.loads(context.response.data) nose.tools.assert_true('ARCHIVE' not in response)
def step_impl(context): modify_data['action'] = 'remove' modify_data['label'] = "ARCHIVE" context.response = app.test_client().put(url.format(context.msg_id), data=flask.json.dumps(modify_data), headers=headers)
def before_all(): world.app = app.test_client()
def client(): return app.test_client()