コード例 #1
0
def test_auth_login_response_from_invalid_json():
    with pytest.raises(ValidationError):
        AuthLogoutResponse.from_json('{"foo": "bar"}')
コード例 #2
0
def test_auth_login_response_from_valid_json():
    resp = AuthLogoutResponse.from_json("{}")
    assert type(resp) == AuthLogoutResponse
コード例 #3
0
import pytest

from mythx_models.response import AuthLogoutResponse

from .common import get_test_case

JSON_DATA, DICT_DATA = get_test_case("testdata/auth-logout-response.json")
OBJ_DATA = AuthLogoutResponse.from_json(JSON_DATA)


def test_auth_login_response_from_valid_json():
    resp = AuthLogoutResponse.from_json("{}")
    assert type(resp) == AuthLogoutResponse


# def test_auth_login_response_from_invalid_json():
#     with pytest.raises(ValidationError):
#         AuthLogoutResponse.from_json('{"foo": "bar"}')


def test_auth_login_response_from_valid_dict():
    resp = AuthLogoutResponse.from_dict({})
    assert type(resp) == AuthLogoutResponse


# def test_auth_login_response_from_invalid_dict():
#     with pytest.raises(ValidationError):
#         AuthLogoutResponse.from_dict({"foo": "bar"})


def test_auth_login_response_to_json():