def testSendNymVerkey(grammar): dest = "LNAyBZUjvLF7duhrNtOWgdAKs18nHdbJUxJLT39iEGU=" role = Roles.TRUST_ANCHOR.name verkey = "LNAyBZUjvLF7duhrNtOWgdAKs18nHdbJUxJLT39iEGU=" # Test with verkey matchedVars = getMatchedVariables( grammar, "send NYM dest={} role={} verkey={}".format(dest, role, verkey)) assertCliTokens(matchedVars, { "send_nym": "send NYM", "dest_id": dest, "role": role, "new_ver_key": verkey }) # Test without verkey matchedVars = getMatchedVariables( grammar, "send NYM dest={} role={}".format(dest, role)) assertCliTokens(matchedVars, { "send_nym": "send NYM", "dest_id": dest, "role": role }) # Verkey being empty string is not supported with pytest.raises(AssertionError): matchedVars = getMatchedVariables( grammar, "send NYM dest={} role={} verkey={}".format(dest, role, ''))
def test_send_get_attrib_regex(grammar): dest = "LNAyBZUjvLF7duhrNtOWgdAKs18nHdbJUxJLT39iEGU=" raw = 'legal' matchedVars = getMatchedVariables(grammar, 'send GET_ATTR dest={} raw={}'.format(dest, raw)) assertCliTokens(matchedVars, { "send_get_attr": "send GET_ATTR", "dest_id": dest, "raw": raw})
def testSendNymWithRole(grammar): dest = "LNAyBZUjvLF7duhrNtOWgdAKs18nHdbJUxJLT39iEGU=" role = Roles.TRUST_ANCHOR.name matchedVars = getMatchedVariables( grammar, "send NYM dest={} role={}".format(dest, role)) assertCliTokens(matchedVars, { "send_nym": "send NYM", "dest_id": dest, "role": role})
def testRequestClaimRegEx(grammar): matchedVars = getMatchedVariables(grammar, "request claim Transcript") assertCliTokens(matchedVars, {"req_claim": "request claim", "claim_name": "Transcript"}) matchedVars = getMatchedVariables(grammar, 'request claim "Transcript"') assertCliTokens(matchedVars, {"req_claim": "request claim", "claim_name": '"Transcript"'})
def testReqAvailClaims(grammar): matchedVars = getMatchedVariables(grammar, "request available claims from Faber") assertCliTokens(matchedVars, { "req_avail_claims": "request available claims from", "link_name": "Faber" })
def testSendAttribRegEx(grammar): dest = "LNAyBZUjvLF7duhrNtOWgdAKs18nHdbJUxJLT39iEGU=" raw = '{"legal org": "BRIGHAM YOUNG UNIVERSITY, PROVO, UT", ' \ '"email": "*****@*****.**"}' matchedVars = getMatchedVariables(grammar, 'send ATTRIB dest={} raw={}'.format(dest, raw)) assertCliTokens(matchedVars, { "send_attrib": "send ATTRIB", "dest_id": dest, "raw": raw})
def testShowClaimRegEx(grammar): matchedVars = getMatchedVariables(grammar, "show claim Transcript") assertCliTokens(matchedVars, {"show_claim": "show claim", "claim_name": "Transcript"}) matchedVars = getMatchedVariables(grammar, 'show claim "Transcript"') assertCliTokens(matchedVars, {"show_claim": "show claim", "claim_name": '"Transcript"'})
def test_send_get_schema(grammar): dest = "LNAyBZUjvLF7duhrNtOWgdAKs18nHdbJUxJLT39iEGU=" name = "Degree" version = "1.0" matchedVars = getMatchedVariables(grammar, 'send GET_SCHEMA dest={} name={} version={}' .format(dest, name, version)) assertCliTokens(matchedVars, { "send_get_schema": "send GET_SCHEMA", NAME: name, VERSION: version})
def testSendSchema(grammar): name = "Degree" version = "1.0" keys = "undergrad,last_name,first_name,birth_date,postgrad,expiry_date" matchedVars = getMatchedVariables(grammar, 'send SCHEMA name={} version={} keys={}' .format(name, version, keys)) assertCliTokens(matchedVars, { "send_schema": "send SCHEMA", NAME: name, VERSION: version, KEYS: keys})
def testShowFileCommandRegEx(grammar): matchedVars = getMatchedVariables(grammar, "show sample/faber-invitation.sovrin") assertCliTokens(matchedVars, { "show_file": "show", "file_path": "sample/faber-invitation.sovrin"}) matchedVars = getMatchedVariables(grammar, "show sample/faber-invitation.sovrin ") assertCliTokens(matchedVars, { "show_file": "show", "file_path": "sample/faber-invitation.sovrin"})
def testLoadFileCommandRegEx(grammar): matchedVars = getMatchedVariables(grammar, "load sample/faber-invitation.sovrin") assertCliTokens(matchedVars, { "load_file": "load", "file_path": "sample/faber-invitation.sovrin"}) matchedVars = getMatchedVariables(grammar, "load sample/faber-invitation.sovrin ") assertCliTokens(matchedVars, { "load_file": "load", "file_path": "sample/faber-invitation.sovrin"})
def testProofReqRegEx(grammar): matchedVars = getMatchedVariables(grammar, "show proof request Transcript") assertCliTokens(matchedVars, {"show_proof_req": "show proof request", "proof_req_name": "Transcript"}) matchedVars = getMatchedVariables(grammar, "show proof request Transcript ") assertCliTokens(matchedVars, {"show_proof_req": "show proof request", "proof_req_name": "Transcript "})
def testNewAddGenTxnRegEx(grammar): exportedData = """{"BCU-steward": {"verkey": "b0739fe3113adbdce9dd994057bed5339e9bf2f99a6b7d4754b8b9d094e7c1e0"}}""" matchedVars = getMatchedVariables(grammar, 'add genesis transaction NYM with data {} role=STEWARD'.format(exportedData)) assertCliTokens(matchedVars, {TXN_TYPE: NYM, ROLE: STEWARD, DATA: exportedData}) exportedData = """{"BCU": {"verkey": "ad1a8dc1836007587f6c6c2d1d6ba91a395616f923b3e63bb5797d52b025a263", "node_address": "127.0.0.1:9701", "client_address": "127.0.0.1:9702"}, "by":ea0690fbea7fbcd8dd4b80ed83f23d0ff2152e6217f602a01532c16c862aab92}""" matchedVars = getMatchedVariables(grammar, 'add genesis transaction NEW_NODE with data {}'.format(exportedData)) assertCliTokens(matchedVars, {TXN_TYPE: NEW_NODE, DATA: exportedData})
def testRenameKeyRingCommandRegEx(grammar): matchedVars = getMatchedVariables(grammar, "rename keyring MyKey1 to MyKey2") assertCliTokens(matchedVars, { "rename_keyring": "rename keyring", "from": "MyKey1", "to": "MyKey2" }) matchedVars = getMatchedVariables(grammar, "rename keyring to MyKey2") assertCliTokens(matchedVars, { "rename_keyring": "rename keyring", "from": None, "to": "MyKey2" })
def testNewIdentifier(grammar): matchedVars = getMatchedVariables( grammar, "new DID") assertCliTokens(matchedVars, {"new_id": "new DID", "id": None, "seed": None, "alias": None}) matchedVars = getMatchedVariables( grammar, "new DID as myalis") assertCliTokens(matchedVars, {"new_id": "new DID", "id": None, "seed": None, "alias": "myalis"}) matchedVars = getMatchedVariables( grammar, "new DID 4QxzWk3ajdnEA37NdNU5Kt") assertCliTokens(matchedVars, {"new_id": "new DID", "id": "4QxzWk3ajdnEA37NdNU5Kt", "seed": None, "alias": None}) matchedVars = getMatchedVariables( grammar, "new DID 4QxzWk3ajdnEA37NdNU5Kt " "with seed aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") assertCliTokens(matchedVars, {"new_id": "new DID", "id": "4QxzWk3ajdnEA37NdNU5Kt", "seed": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "alias": None})
def testSendNymWithVerkey(grammar): dest = "LNAyBZUjvLF7duhrNtOWgdAKs18nHdbJUxJLT39iEGU=" role = "SPONSOR" verkey = "LNAyBZUjvLF7duhrNtOWgdAKs18nHdbJUxJLT39iEGU=" matchedVars = getMatchedVariables( grammar, "send NYM dest={} role={} verkey={}".format(dest, role, verkey)) assertCliTokens( matchedVars, { "send_nym": "send NYM", "dest_id": dest, "role": role, "new_ver_key": verkey })
def testShowFileCommandRegEx(grammar): matchedVars = getMatchedVariables(grammar, "show sample/faber-request.indy") assertCliTokens(matchedVars, { "show_file": "show", "file_path": "sample/faber-request.indy" }) matchedVars = getMatchedVariables(grammar, "show sample/faber-request.indy ") assertCliTokens(matchedVars, { "show_file": "show", "file_path": "sample/faber-request.indy" })
def testNewIdentifier(grammar): matchedVars = getMatchedVariables( grammar, "new identifier") assertCliTokens(matchedVars, {"new_id": "new identifier", "id": None, "seed": None, "alias": None}) matchedVars = getMatchedVariables( grammar, "new identifier as myalis") assertCliTokens(matchedVars, {"new_id": "new identifier", "id": None, "seed": None, "alias": "myalis"}) matchedVars = getMatchedVariables( grammar, "new identifier 4QxzWk3ajdnEA37NdNU5Kt") assertCliTokens(matchedVars, {"new_id": "new identifier", "id": "4QxzWk3ajdnEA37NdNU5Kt", "seed": None, "alias": None}) matchedVars = getMatchedVariables( grammar, "new identifier 4QxzWk3ajdnEA37NdNU5Kt " "with seed aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") assertCliTokens(matchedVars, {"new_id": "new identifier", "id": "4QxzWk3ajdnEA37NdNU5Kt", "seed": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "alias": None})
def testLoadFileCommandRegEx(grammar): matchedVars = getMatchedVariables(grammar, "load sample/faber-request.indy") assertCliTokens(matchedVars, { "load_file": "load", "file_path": "sample/faber-request.indy" }) matchedVars = getMatchedVariables(grammar, "load sample/faber-request.indy ") assertCliTokens(matchedVars, { "load_file": "load", "file_path": "sample/faber-request.indy" })
def testLoadFileCommandRegEx(grammar): matchedVars = getMatchedVariables(grammar, "load sample/faber-invitation.sovrin") assertCliTokens(matchedVars, { "load_file": "load", "file_path": "sample/faber-invitation.sovrin" }) matchedVars = getMatchedVariables(grammar, "load sample/faber-invitation.sovrin ") assertCliTokens(matchedVars, { "load_file": "load", "file_path": "sample/faber-invitation.sovrin" })
def testShowFileCommandRegEx(grammar): matchedVars = getMatchedVariables(grammar, "show sample/faber-invitation.sovrin") assertCliTokens(matchedVars, { "show_file": "show", "file_path": "sample/faber-invitation.sovrin" }) matchedVars = getMatchedVariables(grammar, "show sample/faber-invitation.sovrin ") assertCliTokens(matchedVars, { "show_file": "show", "file_path": "sample/faber-invitation.sovrin" })
def testProofReqRegEx(grammar): matchedVars = getMatchedVariables(grammar, "show proof request Transcript") assertCliTokens( matchedVars, { "show_proof_request": "show proof request", "proof_request_name": "Transcript" }) matchedVars = getMatchedVariables(grammar, "show proof request Transcript ") assertCliTokens( matchedVars, { "show_proof_request": "show proof request", "proof_request_name": "Transcript " })
def testClaimReqRegEx(grammar): matchedVars = getMatchedVariables(grammar, "show claim request Job-Application") assertCliTokens( matchedVars, { "show_claim_req": "show claim request", "claim_req_name": "Job-Application" }) matchedVars = getMatchedVariables(grammar, "show claim request Job-Application ") assertCliTokens( matchedVars, { "show_claim_req": "show claim request", "claim_req_name": "Job-Application " })
def testNewAddGenTxnRegEx(grammar): exportedData = """{"BCU-steward": {"verkey": "b0739fe3113adbdce9dd994057bed5339e9bf2f99a6b7d4754b8b9d094e7c1e0"}}""" matchedVars = getMatchedVariables( grammar, 'add genesis transaction NYM with data {} role=STEWARD'.format( exportedData)) assertCliTokens(matchedVars, { TXN_TYPE: NYM, ROLE: STEWARD, DATA: exportedData }) exportedData = """{"BCU": {"verkey": "ad1a8dc1836007587f6c6c2d1d6ba91a395616f923b3e63bb5797d52b025a263", "node_address": "127.0.0.1:9701", "client_address": "127.0.0.1:9702"}, "by":ea0690fbea7fbcd8dd4b80ed83f23d0ff2152e6217f602a01532c16c862aab92}""" matchedVars = getMatchedVariables( grammar, 'add genesis transaction NODE with data {}'.format(exportedData)) assertCliTokens(matchedVars, {TXN_TYPE: NODE, DATA: exportedData})
def testAddGenTxnByValueRegEx(grammar): matchedVars = getMatchedVariables( grammar, "add genesis transaction {nym} for Tyler role={role}".format( nym=NYM, role=Roles.STEWARD.name)) assertCliTokens(matchedVars, { TXN_TYPE: NYM, ROLE: Roles.STEWARD.name, TARGET_NYM: "Tyler", DATA: None }) matchedVars = getMatchedVariables( grammar, 'add genesis transaction {nym} for Tyler with data {{"key1": "value1"}} role={role}' .format(nym=NYM, role=Roles.STEWARD.name)) assertCliTokens( matchedVars, { TXN_TYPE: NYM, ROLE: Roles.STEWARD.name, TARGET_NYM: "Tyler", DATA: '{"key1": "value1"}' }) matchedVars = getMatchedVariables( grammar, 'add genesis transaction {node} for Tyler by Phil with data {{"key1": "value1", "key2": "value2"}}' .format(node=NODE)) assertCliTokens( matchedVars, { TXN_TYPE: NODE, TARGET_NYM: "Tyler", IDENTIFIER: "Phil", DATA: '{"key1": "value1", "key2": "value2"}' })
def testSendNymVerkey(grammar): dest = "LNAyBZUjvLF7duhrNtOWgdAKs18nHdbJUxJLT39iEGU=" role = Roles.TRUST_ANCHOR.name verkey = "LNAyBZUjvLF7duhrNtOWgdAKs18nHdbJUxJLT39iEGU=" # Test with verkey matchedVars = getMatchedVariables( grammar, "send NYM dest={} role={} verkey={}".format( dest, role, verkey)) assertCliTokens(matchedVars, { "send_nym": "send NYM", "dest_id": dest, "role": role, "new_ver_key": verkey }) # Test without verkey matchedVars = getMatchedVariables( grammar, "send NYM dest={} role={}".format(dest, role)) assertCliTokens(matchedVars, { "send_nym": "send NYM", "dest_id": dest, "role": role }) # Verkey being empty string is supported matchedVars = getMatchedVariables( grammar, "send NYM dest={} role={} verkey={}".format(dest, role, '')) assertCliTokens(matchedVars, { "send_nym": "send NYM", "dest_id": dest, "role": role, "new_ver_key": '' })
def testAddGenTxnRegEx(grammar): matchedVars = getMatchedVariables( grammar, "add genesis transaction NYM dest=2ru5PcgeQzxF7QZYwQgDkG2K13PRqyigVw99zMYg8eML") assertCliTokens(matchedVars, {"add_genesis": "add genesis transaction NYM", "dest": "dest=", "dest_id": "2ru5PcgeQzxF7QZYwQgDkG2K13PRqyigVw99zMYg8eML", "role": None, "ver_key": None}) matchedVars = getMatchedVariables( grammar, "add genesis transaction NYM dest=2ru5PcgeQzxF7QZYwQgDkG2K13PRqyigVw99zMYg8eML role={role}".format( role=Roles.STEWARD.name)) assertCliTokens(matchedVars, {"add_genesis": "add genesis transaction NYM", "dest": "dest=", "dest_id": "2ru5PcgeQzxF7QZYwQgDkG2K13PRqyigVw99zMYg8eML", "role": Roles.STEWARD.name, "ver_key": None}) matchedVars = getMatchedVariables( grammar, 'add genesis transaction NODE for 2ru5PcgeQzxF7QZYwQgDkG2K13PRqyigVw99zMYg8eML ' 'by FvDi9xQZd1CZitbK15BNKFbA7izCdXZjvxf91u3rQVzW with data ' '{"node_ip": "localhost", "node_port": "9701", "client_ip": "localhost", "client_port": "9702", "alias": "AliceNode"}') assertCliTokens( matchedVars, { "add_gen_txn": "add genesis transaction", "type": "NODE", "dest": "2ru5PcgeQzxF7QZYwQgDkG2K13PRqyigVw99zMYg8eML", "identifier": "FvDi9xQZd1CZitbK15BNKFbA7izCdXZjvxf91u3rQVzW", "role": None, "data": '{"node_ip": "localhost", "node_port": "9701", "client_ip": "localhost", "client_port": "9702", "alias": "AliceNode"}'})
def testAddGenTxnRegEx(grammar): matchedVars = getMatchedVariables( grammar, "add genesis transaction NYM for Tyler role=STEWARD") assertCliTokens(matchedVars, { TXN_TYPE: NYM, ROLE: STEWARD, TARGET_NYM: "Tyler", DATA: None }) matchedVars = getMatchedVariables( grammar, 'add genesis transaction NYM for Tyler with data {"key1": "value1"} role=STEWARD' ) assertCliTokens( matchedVars, { TXN_TYPE: NYM, ROLE: STEWARD, TARGET_NYM: "Tyler", DATA: '{"key1": "value1"}' }) matchedVars = getMatchedVariables( grammar, 'add genesis transaction NODE for Tyler by Phil with data {"key1": "value1", "key2": "value2"}' ) assertCliTokens( matchedVars, { TXN_TYPE: NODE, TARGET_NYM: "Tyler", IDENTIFIER: "Phil", DATA: '{"key1": "value1", "key2": "value2"}' })
def testSyncLinkRegEx(grammar): matchedVars = getMatchedVariables(grammar, "sync faber") assertCliTokens(matchedVars, {"sync_link": "sync", "link_name": "faber"}) matchedVars = getMatchedVariables(grammar, 'sync "faber"') assertCliTokens(matchedVars, {"sync_link": "sync", "link_name": '"faber"'}) matchedVars = getMatchedVariables(grammar, 'sync "faber" ') assertCliTokens(matchedVars, {"sync_link": "sync", "link_name": '"faber" '})
def testAddGenTxnRegEx(grammar): matchedVars = getMatchedVariables(grammar, "add genesis transaction NYM for Tyler role=STEWARD") assertCliTokens(matchedVars, {TXN_TYPE: NYM, ROLE: STEWARD, TARGET_NYM: "Tyler", DATA: None}) matchedVars = getMatchedVariables(grammar, 'add genesis transaction NYM for Tyler with data {"key1": "value1"} role=STEWARD') assertCliTokens(matchedVars, {TXN_TYPE: NYM, ROLE: STEWARD, TARGET_NYM: "Tyler", DATA: '{"key1": "value1"}'}) matchedVars = getMatchedVariables(grammar, 'add genesis transaction NEW_NODE for Tyler by Phil with data {"key1": "value1", "key2": "value2"}') assertCliTokens(matchedVars, {TXN_TYPE: NEW_NODE, TARGET_NYM: "Tyler", IDENTIFIER: "Phil", DATA: '{"key1": "value1", "key2": "value2"}'})
def testShowLinkRegEx(grammar): matchedVars = getMatchedVariables(grammar, "show link faber") assertCliTokens(matchedVars, {"show_link": "show link", "link_name": "faber"}) matchedVars = getMatchedVariables(grammar, "show link faber college") assertCliTokens(matchedVars, {"show_link": "show link", "link_name": "faber college"}) matchedVars = getMatchedVariables(grammar, "show link faber college ") assertCliTokens(matchedVars, {"show_link": "show link", "link_name": "faber college "})
def testAcceptInvitationLinkRegEx(grammar): matchedVars = getMatchedVariables(grammar, "accept invitation from faber") assertCliTokens(matchedVars, {"accept_link_invite": "accept invitation from", "link_name": "faber"}) matchedVars = getMatchedVariables(grammar, 'accept invitation from "faber"') assertCliTokens(matchedVars, {"accept_link_invite": "accept invitation from", "link_name": '"faber"'}) matchedVars = getMatchedVariables(grammar, 'accept invitation from "faber" ') assertCliTokens(matchedVars, {"accept_link_invite": "accept invitation from", "link_name": '"faber" '})
def testShowLinkRegEx(grammar): matchedVars = getMatchedVariables(grammar, "show connection faber") assertCliTokens(matchedVars, {"show_connection": "show connection", "connection_name": "faber"}) matchedVars = getMatchedVariables(grammar, "show connection faber college") assertCliTokens(matchedVars, {"show_connection": "show connection", "connection_name": "faber college"}) matchedVars = getMatchedVariables( grammar, "show connection faber college ") assertCliTokens(matchedVars, {"show_connection": "show connection", "connection_name": "faber college "})
def testAcceptInvitationLinkRegEx(grammar): matchedVars = getMatchedVariables(grammar, "accept request from faber") assertCliTokens(matchedVars, {"accept_connection_request": "accept request from", "connection_name": "faber"}) matchedVars = getMatchedVariables(grammar, 'accept request from "faber"') assertCliTokens(matchedVars, {"accept_connection_request": "accept request from", "connection_name": '"faber"'}) matchedVars = getMatchedVariables(grammar, 'accept request from "faber" ') assertCliTokens(matchedVars, {"accept_connection_request": "accept request from", "connection_name": '"faber" '})
def testAddGenTxnRegEx(grammar): matchedVars = getMatchedVariables(grammar, "add genesis transaction NYM dest=2ru5PcgeQzxF7QZYwQgDkG2K13PRqyigVw99zMYg8eML") assertCliTokens(matchedVars, {"add_genesis": "add genesis transaction NYM", "dest": "dest=", "dest_id": "2ru5PcgeQzxF7QZYwQgDkG2K13PRqyigVw99zMYg8eML", "role": None, "ver_key": None}) matchedVars = getMatchedVariables(grammar, "add genesis transaction NYM dest=2ru5PcgeQzxF7QZYwQgDkG2K13PRqyigVw99zMYg8eML role={role}".format( role=Roles.STEWARD.name)) assertCliTokens(matchedVars, {"add_genesis": "add genesis transaction NYM", "dest": "dest=", "dest_id": "2ru5PcgeQzxF7QZYwQgDkG2K13PRqyigVw99zMYg8eML", "role": Roles.STEWARD.name, "ver_key": None}) matchedVars = getMatchedVariables(grammar, 'add genesis transaction NODE for 2ru5PcgeQzxF7QZYwQgDkG2K13PRqyigVw99zMYg8eML ' 'by FvDi9xQZd1CZitbK15BNKFbA7izCdXZjvxf91u3rQVzW with data ' '{"node_ip": "localhost", "node_port": "9701", "client_ip": "localhost", "client_port": "9702", "alias": "AliceNode"}') assertCliTokens(matchedVars, {"add_gen_txn": "add genesis transaction", "type": "NODE", "dest": "2ru5PcgeQzxF7QZYwQgDkG2K13PRqyigVw99zMYg8eML", "identifier": "FvDi9xQZd1CZitbK15BNKFbA7izCdXZjvxf91u3rQVzW", "role": None, "data": '{"node_ip": "localhost", "node_port": "9701", "client_ip": "localhost", "client_port": "9702", "alias": "AliceNode"}'})
def testSendProofReqRegEx(grammar): matchedVars = getMatchedVariables(grammar, "send proof-request Over-21 to JaneDoe") assertCliTokens(matchedVars, {"send_proof_req": "send proof-request", "proof_request_name": "Over-21", "target": " JaneDoe"})
def testNewKeyRingCommandRegEx(grammar): matchedVars = getMatchedVariables(grammar, "new keyring MyKey1") assertCliTokens(matchedVars, {"new_keyring": "new keyring", "name": "MyKey1"}) matchedVars = getMatchedVariables(grammar, "new keyring MyKey1 ") assertCliTokens(matchedVars, {"new_keyring": "new keyring", "name": "MyKey1"})
def testDisconnect(grammar): matchedVars = getMatchedVariables( grammar, "disconnect") assertCliTokens(matchedVars, {"disconn": "disconnect"})
def testSendProofReqRegEx(grammar): matchedVars = getMatchedVariables(grammar, "send proof-request Over-21 to JaneDoe") assertCliTokens(matchedVars, {"send_proof_request": "send proof-request", "proof_request_name": "Over-21", "target": " JaneDoe"})
def testNewIdentifier(grammar): matchedVars = getMatchedVariables( grammar, "new identifier") assertCliTokens(matchedVars, {"new_id": "new identifier", "id_or_abbr_or_crypto": None, "seed": None, "alias": None}) matchedVars = getMatchedVariables( grammar, "new identifier as myalis") assertCliTokens(matchedVars, {"new_id": "new identifier", "id_or_abbr_or_crypto": None, "seed": None, "alias": "myalis"}) matchedVars = getMatchedVariables( grammar, "new identifier abbr") assertCliTokens(matchedVars, {"new_id": "new identifier", "id_or_abbr_or_crypto": "abbr", "seed": None, "alias": None}) matchedVars = getMatchedVariables( grammar, "new identifier 4QxzWk3ajdnEA37NdNU5Kt") assertCliTokens(matchedVars, {"new_id": "new identifier", "id_or_abbr_or_crypto": "4QxzWk3ajdnEA37NdNU5Kt", "seed": None, "alias": None}) matchedVars = getMatchedVariables( grammar, "new identifier 4QxzWk3ajdnEA37NdNU5Kt " "with seed aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") assertCliTokens(matchedVars, {"new_id": "new identifier", "id_or_abbr_or_crypto": "4QxzWk3ajdnEA37NdNU5Kt", "seed": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "alias": None}) matchedVars = getMatchedVariables( grammar, "new identifier abbr with seed aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") assertCliTokens(matchedVars, {"new_id": "new identifier", "id_or_abbr_or_crypto": "abbr", "seed": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "alias": None}) matchedVars = getMatchedVariables( grammar, "new identifier crypto with seed aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") assertCliTokens(matchedVars, {"new_id": "new identifier", "id_or_abbr_or_crypto": "crypto", "seed": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "alias": None}) matchedVars = getMatchedVariables( grammar, "new identifier crypto with seed aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa as myalias") assertCliTokens(matchedVars, {"new_id": "new identifier", "id_or_abbr_or_crypto": "crypto", "seed": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "alias": "myalias"})
def test_send_get_claim_def_regex(grammar): matchedVars = getMatchedVariables(grammar, "send GET_CLAIM_DEF ref=15 signature_type=CL") from sovrin_common.constants import SIGNATURE_TYPE assertCliTokens(matchedVars, { "send_get_claim_def": "send GET_CLAIM_DEF", REF: "15", SIGNATURE_TYPE: "CL"})
def testSendNymWithoutRole(grammar): dest = "LNAyBZUjvLF7duhrNtOWgdAKs18nHdbJUxJLT39iEGU=" matchedVars = getMatchedVariables(grammar, 'send NYM dest={}'.format(dest)) assertCliTokens(matchedVars, { "send_nym": "send NYM", "dest_id": dest})
def testSetAttribute(grammar): matchedVars = getMatchedVariables( grammar, "set first_name to Alice") assertCliTokens(matchedVars, { "set_attr": "set", "attr_name": "first_name", "attr_value": "Alice"})
def testPingTargetRegEx(grammar): matchedVars = getMatchedVariables(grammar, "ping faber") assertCliTokens(matchedVars, {"ping": "ping", "target_name": "faber"})
def testSendClaimDefRegEx(grammar): matchedVars = getMatchedVariables(grammar, "send CLAIM_DEF ref=15 signature_type=CL") from sovrin_common.constants import SIGNATURE_TYPE assertCliTokens(matchedVars, { "send_claim_def": "send CLAIM_DEF", REF: "15", SIGNATURE_TYPE: "CL"})
def testGetNym(grammar): dest = "LNAyBZUjvLF7duhrNtOWgdAKs18nHdbJUxJLT39iEGU=" matchedVars = getMatchedVariables( grammar, "send GET_NYM dest={}".format(dest)) assertCliTokens(matchedVars, { "send_get_nym": "send GET_NYM", "dest_id": dest})
def testNewKeypairCommandRegEx(grammar): matchedVars = getMatchedVariables(grammar, "new key") assertCliTokens(matchedVars, { "new_key": "new key", "alias": None, "seed": None }) matchedVars = getMatchedVariables(grammar, "new key test") assertCliTokens(matchedVars, { "new_key": "new key", "alias": "test", "seed": None }) matchedVars = getMatchedVariables(grammar, "new key as test") assertCliTokens(matchedVars, { "new_key": "new key", "alias": "test", "seed": None }) matchedVars = getMatchedVariables( grammar, "new key with seed " + 's' * 32 + " as test") assertCliTokens(matchedVars, { "new_key": "new key", "alias": "test", "seed": 's' * 32 }) matchedVars = getMatchedVariables( grammar, "new key with seed " + 's' * 32 + " test") assertCliTokens(matchedVars, { "new_key": "new key", "alias": "test", "seed": 's' * 32 }) matchedVars = getMatchedVariables(grammar, "new key with seed " + 's' * 32) assertCliTokens(matchedVars, { "new_key": "new key", "alias": None, "seed": 's' * 32 })
def testRenameKeyRingCommandRegEx(grammar): matchedVars = getMatchedVariables(grammar, "rename keyring MyKey1 to MyKey2") assertCliTokens(matchedVars, {"rename_keyring": "rename keyring", "from": "MyKey1", "to": "MyKey2"}) matchedVars = getMatchedVariables(grammar, "rename keyring to MyKey2") assertCliTokens(matchedVars, {"rename_keyring": "rename keyring", "from": None, "to": "MyKey2"})
def testPromptCommandRegEx(grammar): matchedVars = getMatchedVariables(grammar, "prompt Alice") assertCliTokens(matchedVars, {"prompt": "prompt", "name": "Alice"}) matchedVars = getMatchedVariables(grammar, "prompt Alice ") assertCliTokens(matchedVars, {"prompt": "prompt", "name": "Alice"})
def testNewKeypairCommandRegEx(grammar): matchedVars = getMatchedVariables(grammar, "new key") assertCliTokens(matchedVars, {"new_key":"new key", "alias":None, "seed":None}) matchedVars = getMatchedVariables(grammar, "new key test") assertCliTokens(matchedVars, {"new_key": "new key", "alias": "test", "seed": None}) matchedVars = getMatchedVariables(grammar, "new key as test") assertCliTokens(matchedVars, {"new_key": "new key", "alias": "test", "seed": None}) matchedVars = getMatchedVariables(grammar, "new key with seed " + 's'*32 + " as test") assertCliTokens(matchedVars, {"new_key": "new key", "alias": "test", "seed": 's'*32}) matchedVars = getMatchedVariables(grammar, "new key with seed " + 's' * 32 + " test") assertCliTokens(matchedVars, {"new_key": "new key", "alias": "test", "seed": 's' * 32}) matchedVars = getMatchedVariables(grammar, "new key with seed " + 's' * 32) assertCliTokens(matchedVars, {"new_key": "new key", "alias": None, "seed": 's' * 32})
def test_send_get_claim_def_regex(grammar): matchedVars = getMatchedVariables( grammar, "send GET_CLAIM_DEF ref=15 signature_type=CL") from indy_common.constants import SIGNATURE_TYPE assertCliTokens(matchedVars, { "send_get_claim_def": "send GET_CLAIM_DEF", REF: "15", SIGNATURE_TYPE: "CL"})