Ejemplo n.º 1
0
def test_users_can_be_edited_using_simple_dict_representation():
    user_john = {
        "name": "John Smith",
        "email": "*****@*****.**",
        "facility_user_id": "js90",
        "affiliation": "ESS",
    }
    test_entry = Entry()

    test_entry.users = [user_john]

    assert test_entry.users == [user_john]
Ejemplo n.º 2
0
def test_if_placeholder_used_then_users_replaced_by_placeholder():
    user_john = {
        "name": "John Smith",
        "email": "*****@*****.**",
        "facility_user_id": "js90",
        "affiliation": "ESS",
    }

    test_entry = Entry()
    test_entry.users = [user_john]

    test_entry.users_placeholder = True
    dictionary = test_entry.as_dict([])

    assert len(extract_based_on_nx_class(dictionary, NX_USER)) == 0
    assert USERS_PLACEHOLDER in dictionary["children"]
Ejemplo n.º 3
0
def test_users_are_in_dictionary():
    user_john = {
        "name": "John Smith",
        "email": "*****@*****.**",
        "facility_user_id": "js90",
        "affiliation": "ESS",
    }

    user_betty = {
        "name": "Betty Boo",
        "email": "*****@*****.**",
        "facility_user_id": "bb70",
        "affiliation": "She Rockers",
    }

    test_entry = Entry()
    test_entry.users = [user_john, user_betty]

    dictionary = test_entry.as_dict([])
    result = extract_based_on_nx_class(dictionary, NX_USER)

    assert_matching_datasets_exist(result[0], user_john)
    assert_matching_datasets_exist(result[1], user_betty)