Esempio n. 1
0
def test_update_nym(nym_handler):
    identifier = "identifier"
    txn1 = create_nym_txn(identifier, STEWARD)
    txn2 = create_nym_txn(identifier, "")

    update_nym(nym_handler.state, identifier, STEWARD)
    nym_data = get_nym_details(nym_handler.state, identifier)
    assert get_payload_data(txn1)[ROLE] == nym_data[ROLE]

    update_nym(nym_handler.state, identifier, "")
    nym_data = get_nym_details(nym_handler.state, identifier)
    assert get_payload_data(txn2)[ROLE] == nym_data[ROLE]
Esempio n. 2
0
def test_is_steward(nym_handler):
    identifier = "test_identifier"
    target_nym = "test_target_nym"
    txn = create_nym_txn(identifier, STEWARD, target_nym)
    nym_handler.update_state(txn, None, None)
    assert is_steward(nym_handler.state, target_nym)
    assert not is_steward(nym_handler.state, "other_identifier")
Esempio n. 3
0
def test_get_role_nym_without_role(nym_handler):
    identifier = "test_identifier"
    target_nym = "test_target_nym"
    txn = create_nym_txn(identifier, "", target_nym)
    nym_handler.update_state(txn, None, None)
    nym_data = get_role(nym_handler.state, target_nym)
    assert not nym_data