예제 #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
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
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()