Esempio n. 1
0
def _verify_create(ns_id, api_client, e_data):
    e_resp = api_client.post_data("/events", e_data)
    if e_resp.status_code != 200:
        raise CreateError("Expected status 200, got {}".format(
            e_resp.status_code))

    e_resp_data = json.loads(e_resp.data)
    assert e_resp_data["object"] == "event"
    assert e_resp_data["account_id"] == ns_id
    assert e_resp_data["title"] == e_data["title"]
    assert e_resp_data["location"] == e_data["location"]
    for k, v in iteritems(e_data["when"]):
        assert time_parse(e_resp_data["when"][k]) == time_parse(v)
    assert "id" in e_resp_data
    e_id = e_resp_data["id"]
    e_get_resp = api_client.get_data("/events/" + e_id)

    assert e_get_resp["object"] == "event"
    assert e_get_resp["account_id"] == ns_id
    assert e_get_resp["id"] == e_id
    assert e_get_resp["title"] == e_data["title"]
    for k, v in iteritems(e_data["when"]):
        assert time_parse(e_get_resp["when"][k]) == time_parse(v)

    return e_resp_data
Esempio n. 2
0
def test_time_parse():
    t = 1426008600
    validated = parse_utc(t)
    stored = time_parse(t)

    assert validated.naive == stored

    t = str(1426008600)
    validated = parse_utc(t)
    stored = time_parse(t)

    assert validated.naive == stored
Esempio n. 3
0
def test_time_parse():
    t = 1426008600
    validated = parse_utc(t)
    stored = time_parse(t)

    assert validated.naive == stored

    t = str(1426008600)
    validated = parse_utc(t)
    stored = time_parse(t)

    assert validated.naive == stored