コード例 #1
0
def test_holidays(api):
    """Test calling the "holidays" endpoint."""

    # initialize
    init_tests(api, fixtures="basic")

    # call the "holidays" endpoint and check the response
    resp = api.holidays(year=2020, country="AU")
    assert resp.code == 200
    assert isinstance(resp.headers, dict)
    assert isinstance(resp.raw, bytes)
    assert resp.json["status"] == "success"
    assert isinstance(resp.json["data"], list)
コード例 #2
0
def test_date(api):
    """Test calling the "date" endpoint."""

    # initialize
    init_tests(api, fixtures="basic")

    # call the "date" endpoint and check the response
    resp = api.date("AU", date="2019-01-01", subdivision="NSW")
    assert resp.code == 200
    assert isinstance(resp.headers, dict)
    assert isinstance(resp.raw, bytes)
    assert resp.json["status"] == "success"
    assert isinstance(resp.json["data"], dict)
コード例 #3
0
def test_locations(api):
    """Test calling the "locations" endpoint."""

    # initialize
    init_tests(api, fixtures="basic")

    # call the "locations" endpoint and check the response
    resp = api.locations()
    assert resp.code == 200
    assert isinstance(resp.headers, dict)
    assert isinstance(resp.raw, bytes)
    assert resp.json["status"] == "success"

    assert isinstance(resp.json["data"], list)
コード例 #4
0
def test_business_days(api):
    """Test calling the "business-days" endpoint."""

    # initialize
    init_tests(api, fixtures="basic")

    # call the "holidays" endpoint and check the response
    resp = api.business_days("2020-01-01", "2020-02-01", country="AU")
    assert resp.code == 200
    assert isinstance(resp.headers, dict)
    assert isinstance(resp.raw, bytes)
    assert resp.json["status"] == "success"
    assert resp.json["data"]["business_days"] and resp.json["data"][
        "total_days"]
コード例 #5
0
def test_me(api):
    """Test calling the "me" endpoint."""

    # initialize
    init_tests(api, fixtures="basic")

    # call the "me" endpoint and check the response
    resp = api.me()
    assert resp.code == 200
    assert isinstance(resp.headers, dict)
    assert isinstance(resp.raw, bytes)
    assert resp.json["status"] == "success"

    assert resp.json["email"] and resp.json["name"]