コード例 #1
0
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)
コード例 #2
0
 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
コード例 #3
0
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']
コード例 #4
0
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)
コード例 #5
0
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'}
コード例 #6
0
def client(monkeypatch):
    from app.application import app
    client = app.test_client()
    return client
コード例 #7
0
def step_impl(context):
    context.response = app.test_client().post(url,
                                              data=json.dumps(data),
                                              headers=headers)
コード例 #8
0
def step_impl(context):
    url = "http://localhost:5050/message/send"
    context.response = app.test_client().post(url, headers=headers)
コード例 #9
0
def step_impl(context):
    headers['user_urn'] = 'internal.122342'
    context.response = app.test_client().get(url, headers=headers)
コード例 #10
0
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)
コード例 #11
0
def step_impl(context):
    new_url = url + str(uuid.uuid4())
    context.response = app.test_client().get(new_url, headers=headers)
コード例 #12
0
def step_impl(context):
    new_url = url + context.msg_id
    context.response = app.test_client().get(new_url, headers=headers)
コード例 #13
0
ファイル: steps.py プロジェクト: ohlemacher/behaviorDrivenDev
def before_all():
    """Setup for testing."""
    world.app = app.test_client()
コード例 #14
0
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)
コード例 #15
0
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)
コード例 #16
0
ファイル: steps.py プロジェクト: macndesign/bdd_api_testing
def before_all():
    world.app = app.test_client()
コード例 #17
0
def before_all():
    world.app = app.test_client()
コード例 #18
0
def client():
    return app.test_client()