Ejemplo n.º 1
0
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, ''))
Ejemplo n.º 2
0
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})
Ejemplo n.º 3
0
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"'})
Ejemplo n.º 4
0
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"'})
Ejemplo n.º 5
0
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" '})
Ejemplo n.º 6
0
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"})
Ejemplo n.º 7
0
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 "})
Ejemplo n.º 8
0
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"})
Ejemplo n.º 9
0
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" '})
Ejemplo n.º 10
0
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 "})
Ejemplo n.º 11
0
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"
    })
Ejemplo n.º 12
0
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"
    })
Ejemplo n.º 13
0
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"
    })
Ejemplo n.º 14
0
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"
    })
Ejemplo n.º 15
0
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 "
        })
Ejemplo n.º 16
0
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=STEWARD"
    )
    assertCliTokens(
        matchedVars, {
            "add_genesis": "add genesis transaction NYM",
            "dest": "dest=",
            "dest_id": "2ru5PcgeQzxF7QZYwQgDkG2K13PRqyigVw99zMYg8eML",
            "role": "STEWARD",
            "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"}'
        })
Ejemplo n.º 18
0
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})
Ejemplo n.º 19
0
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})
Ejemplo n.º 20
0
def testSetAttribute(grammar):
    matchedVars = getMatchedVariables(grammar, "set first_name to Alice")
    assertCliTokens(matchedVars, {
        "set_attr": "set",
        "attr_name": "first_name",
        "attr_value": "Alice"
    })
Ejemplo n.º 21
0
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 "
        })
Ejemplo n.º 22
0
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})
Ejemplo n.º 23
0
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
    })
Ejemplo n.º 24
0
def testReqAvailClaims(grammar):
    matchedVars = getMatchedVariables(grammar,
                                      "request available claims from Faber")

    assertCliTokens(matchedVars, {
        "request_avail_claims": "request available claims from",
        "connection_name": "Faber"
    })
Ejemplo n.º 25
0
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})
Ejemplo n.º 26
0
def testReqAvailClaims(grammar):
    matchedVars = getMatchedVariables(grammar,
                                      "request available claims from Faber")

    assertCliTokens(matchedVars, {
        "req_avail_claims": "request available claims from",
        "link_name": "Faber"
    })
Ejemplo n.º 27
0
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})
Ejemplo n.º 28
0
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})
Ejemplo n.º 29
0
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"})
Ejemplo n.º 30
0
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 "
    })
Ejemplo n.º 31
0
def testSendPoolUpgrade(grammar):
    # Testing for start
    getMatchedVariables(grammar, "send POOL_UPGRADE name=upgrade-13 "
                                 "version=0.0.6 sha256=f284bdc3c1c9e24a494e285cb387c69510f28de51c15bb93179d9c7f28705398 action=start "
                                 "schedule={'AtDfpKFe1RPgcr5nnYBw1Wxkgyn8Zjyh5MzFoEUTeoV3': "
                                 "'2017-01-25T12:49:05.258870+00:00', "
                                 "'4yC546FFzorLPgTNTc6V43DnpFrR8uHvtunBxb2Suaa2': "
                                 "'2017-01-25T12:33:53.258870+00:00', "
                                 "'JpYerf4CssDrH76z7jyQPJLnZ1vwYgvKbvcp16AB5RQ': "
                                 "'2017-01-25T12:44:01.258870+00:00', "
                                 "'DG5M4zFm33Shrhjj6JB7nmx9BoNJUq219UXDfvwBDPe2': "
                                 "'2017-01-25T12:38:57.258870+00:00'} "
                                 "timeout=10")

    # Testing for cancel
    getMatchedVariables(grammar, 'send POOL_UPGRADE name=upgrade-13 version=0.0.6 '
                                 'sha256=aad1242 action=cancel '
                                 'justification="not gonna give you"')
Ejemplo n.º 32
0
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"
    })
Ejemplo n.º 33
0
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})
Ejemplo n.º 34
0
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})
Ejemplo n.º 35
0
def testSyncLinkRegEx(grammar):
    matchedVars = getMatchedVariables(grammar, "sync faber")
    assertCliTokens(matchedVars, {
        "sync_connection": "sync",
        "connection_name": "faber"
    })

    matchedVars = getMatchedVariables(grammar, 'sync "faber"')
    assertCliTokens(matchedVars, {
        "sync_connection": "sync",
        "connection_name": '"faber"'
    })

    matchedVars = getMatchedVariables(grammar, 'sync "faber" ')
    assertCliTokens(matchedVars, {
        "sync_connection": "sync",
        "connection_name": '"faber" '
    })
Ejemplo n.º 36
0
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"
        })
Ejemplo n.º 37
0
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})
Ejemplo n.º 38
0
def testSendPoolUpgrade(grammar):
    # Testing for start
    getMatchedVariables(grammar, "send POOL_UPGRADE name=upgrade-13 "
                                 "version=0.0.6 sha256=f284bdc3c1c9e24a494e285cb387c69510f28de51c15bb93179d9c7f28705398 action=start "
                                 "schedule={'AtDfpKFe1RPgcr5nnYBw1Wxkgyn8Zjyh5MzFoEUTeoV3': "
                                 "'2017-01-25T12:49:05.258870+00:00', "
                                 "'4yC546FFzorLPgTNTc6V43DnpFrR8uHvtunBxb2Suaa2': "
                                 "'2017-01-25T12:33:53.258870+00:00', "
                                 "'JpYerf4CssDrH76z7jyQPJLnZ1vwYgvKbvcp16AB5RQ': "
                                 "'2017-01-25T12:44:01.258870+00:00', "
                                 "'DG5M4zFm33Shrhjj6JB7nmx9BoNJUq219UXDfvwBDPe2': "
                                 "'2017-01-25T12:38:57.258870+00:00'} "
                                 "timeout=10")

    # Testing for cancel
    getMatchedVariables(grammar, 'send POOL_UPGRADE name=upgrade-13 version=0.0.6 '
                                 'sha256=aad1242 action=cancel '
                                 'justification="not gonna give you"')
Ejemplo n.º 39
0
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})
Ejemplo n.º 40
0
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 "
    })
Ejemplo n.º 41
0
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"
        })
Ejemplo n.º 42
0
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" '
    })
Ejemplo n.º 43
0
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
    })
Ejemplo n.º 44
0
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"}'})
Ejemplo n.º 45
0
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
        })
Ejemplo n.º 46
0
def test_gen_verif_nonce_reg_ex(grammar):
    getMatchedVariables(grammar, "generate verification nonce")
Ejemplo n.º 47
0
def testAddAttrRegEx(grammar):
    getMatchedVariables(
        grammar,
        "add attribute first_name=Tyler,last_name=Ruff,birth_date=12/17/1991,undergrad=True,postgrad=True,expiry_date=12/31/2101 for Tyler")
Ejemplo n.º 48
0
def testAddAttrProverRegEx(grammar):
    getMatchedVariables(grammar,
                        "attribute known to BYU first_name=Tyler, last_name=Ruff, birth_date=12/17/1991, undergrad=True, postgrad=True, expiry_date=12/31/2101")
Ejemplo n.º 49
0
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"})
Ejemplo n.º 50
0
def test_prep_proof_reg_ex(grammar):
    getMatchedVariables(grammar,
                        "prepare proof of degree using nonce "
                        "mynonce for undergrad")
Ejemplo n.º 51
0
def testPingTargetRegEx(grammar):
    matchedVars = getMatchedVariables(grammar, "ping faber")
    assertCliTokens(matchedVars, {"ping": "ping", "target_name": "faber"})
Ejemplo n.º 52
0
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"})
Ejemplo n.º 53
0
def testSetAttribute(grammar):
    matchedVars = getMatchedVariables(
        grammar, "set first_name to Alice")
    assertCliTokens(matchedVars, {
        "set_attr": "set", "attr_name": "first_name", "attr_value": "Alice"})
Ejemplo n.º 54
0
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})
Ejemplo n.º 55
0
def testSendProof(grammar):
    getMatchedVariables(grammar, 'send proof Job-Application to Acme')
Ejemplo n.º 56
0
def testSendNymWithoutRole(grammar):
    dest = "LNAyBZUjvLF7duhrNtOWgdAKs18nHdbJUxJLT39iEGU="
    matchedVars = getMatchedVariables(grammar, 'send NYM dest={}'.format(dest))
    assertCliTokens(matchedVars, {
        "send_nym": "send NYM", "dest_id": dest})
Ejemplo n.º 57
0
def testDisconnect(grammar):
    matchedVars = getMatchedVariables(
        grammar, "disconnect")
    assertCliTokens(matchedVars, {"disconn": "disconnect"})
Ejemplo n.º 58
0
def test_verify_proof_reg_ex(grammar):
    getMatchedVariables(grammar,
                        "verify status is undergrad in proof degreeproof")
Ejemplo n.º 59
0
def testConnectRegEx(grammar):
    getMatchedVariables(grammar, "connect dummy")
    getMatchedVariables(grammar, "connect test")
    getMatchedVariables(grammar, "connect live")