Beispiel #1
0
def test_zone_serdes():
    s = to_json_string(forward_zone)
    print(json.dumps(s, indent=4))
    z = from_json_string(s, Zone.from_dict)

    assert z.name == forward_zone.name
    assert z.connection.primary_server == forward_zone.connection.primary_server
    assert all([a.__dict__ == b.__dict__ for a, b in zip(z.acl.rules, forward_zone.acl.rules)])
def test_record_set_changes_serdes(record_set):
    a = gen_rs_change(record_set)
    s = to_json_string(a)
    b = from_json_string(s, RecordSetChange.from_dict)

    assert a.user_id == b.user_id
    assert a.change_type == b.change_type
    assert a.status == b.status
    assert a.created == b.created
    assert a.system_message == b.system_message
    assert a.id == b.id
    assert a.user_name == b.user_name
    assert a.zone.id == b.zone.id
    check_record_sets_are_equal(a.record_set, b.record_set)
    check_record_sets_are_equal(a.updates, b.updates)
def test_list_record_set_response_serdes():
    a = ListRecordSetsResponse(record_sets=record_set_values,
                               start_from='some-start',
                               next_id='next',
                               max_items=100,
                               record_name_filter='foo*')
    s = to_json_string(a)
    b = from_json_string(s, ListRecordSetsResponse.from_dict)

    assert a.start_from == b.start_from
    assert a.next_id == b.next_id
    assert a.max_items == b.max_items
    assert a.record_name_filter == b.record_name_filter
    assert len(a.record_sets) == len(b.record_sets)
    for l, r in zip(a.record_sets, b.record_sets):
        check_record_sets_are_equal(l, r)
def test_record_set_serdes(record_set):
    rs = record_set
    s = to_json_string(rs)
    r = from_json_string(s, RecordSet.from_dict)
    check_record_sets_are_equal(r, rs)
Beispiel #5
0
def test_group_serdes():
    r = from_json_string(to_json_string(sample_group), Group.from_dict)
    check_groups_are_same(sample_group, r)