Example #1
0
def test_parse_http_success_with_config_key_returns_expected_result():
    resp = parse_http_success(
        fake_get_test(body=json.dumps({'config': 'Some Config'})))
    assert resp.ok is True
    assert resp.data == 'Some Config'
    assert resp.status_code == 200
    assert resp.reason == 'Success'
Example #2
0
def test_parse_http_success_with_template_definition_key_returns_expected_result(
):
    resp = parse_http_success(
        fake_get_test(
            body=json.dumps({'templateDefinition': 'Some Template'})))
    assert resp.ok is True
    assert resp.data == 'Some Template'
    assert resp.status_code == 200
    assert resp.reason == 'Success'
Example #3
0
def test_parse_http_success_returns_json_with_empty_data_key_returns_empty_dict(
):
    resp = parse_http_success(fake_get_test(body=json.dumps({'data': []})))
    assert isinstance(resp.data, dict)
Example #4
0
def test_parse_http_success_returns_with_populated_data_dict_returns_list():
    resp = parse_http_success(
        fake_get_test(body=json.dumps({'data': [{
            'key': 'value'
        }]})))
    assert isinstance(resp.data, list)
Example #5
0
def test_parse_http_success_with_no_data_returns_expected_result():
    resp = parse_http_success(fake_get_test())
    assert resp.ok is True
    assert resp.data == {}
    assert resp.status_code == 200
    assert resp.reason == 'Success'
Example #6
0
def test_parse_http_success_returns_result_object():
    resp = parse_http_success(fake_get_test())
    assert isinstance(resp, Result)