def testMissingFragmentDid(): did_reference = "did:dad:iy67FstqFl_a5e-sni6yAWoj60-1E2RtzmMGjrjHaSY=/customers/1234?color=blue" did = didering.Did(did_reference) exp_scheme = "did" exp_method = "dad" exp_idstring = "iy67FstqFl_a5e-sni6yAWoj60-1E2RtzmMGjrjHaSY=" exp_query = "color=blue" exp_path = "/customers/1234" exp_fragment = None didAssertions(did_reference, did, exp_scheme, exp_method, exp_idstring, exp_query, exp_path, exp_fragment)
def testMissingPathDid(): did_reference = "did:dad:iy67FstqFl_a5e-sni6yAWoj60-1E2RtzmMGjrjHaSY=?color=blue#test_did" did = didering.Did(did_reference) exp_scheme = "did" exp_method = "dad" exp_idstring = "iy67FstqFl_a5e-sni6yAWoj60-1E2RtzmMGjrjHaSY=" exp_query = "color=blue" exp_path = "" exp_fragment = "test_did" didAssertions(did_reference, did, exp_scheme, exp_method, exp_idstring, exp_query, exp_path, exp_fragment)
def testComplexQueryDid(): did_reference = "did:dad:iy67FstqFl_a5e-sni6yAWoj60-1E2RtzmMGjrjHaSY=/customers/1234?color=blue&type=tshirt#test_did" did = didering.Did(did_reference) exp_scheme = "did" exp_method = "dad" exp_idstring = "iy67FstqFl_a5e-sni6yAWoj60-1E2RtzmMGjrjHaSY=" exp_query = "color=blue&type=tshirt" exp_path = "/customers/1234" exp_fragment = "test_did" didAssertions(did_reference, did, exp_scheme, exp_method, exp_idstring, exp_query, exp_path, exp_fragment)
def testComplexIdstringWithReferenceDid(): did_reference = "did:ala:quor:testnet1:QmeeasCZ9bjLbXhwFd7Fidz6CBziJQJpcUueBJ7d7csxhb/customers/1234?color=blue#test_did" did = didering.Did(did_reference) exp_scheme = "did" exp_method = "ala" exp_idstring = "quor:testnet1:QmeeasCZ9bjLbXhwFd7Fidz6CBziJQJpcUueBJ7d7csxhb" exp_query = "color=blue" exp_path = "/customers/1234" exp_fragment = "test_did" didAssertions(did_reference, did, exp_scheme, exp_method, exp_idstring, exp_query, exp_path, exp_fragment)
def testComplexIdstringWithoutReferenceDid(): did_reference = "did:ala:quor:testnet1:QmeeasCZ9bjLbXhwFd7Fidz6CBziJQJpcUueBJ7d7csxhb" did = didering.Did(did_reference) exp_scheme = "did" exp_method = "ala" exp_idstring = "quor:testnet1:QmeeasCZ9bjLbXhwFd7Fidz6CBziJQJpcUueBJ7d7csxhb" exp_query = None exp_path = "" exp_fragment = None didAssertions(did_reference, did, exp_scheme, exp_method, exp_idstring, exp_query, exp_path, exp_fragment)
def testDIDOnlyDid(): # No Query, Path, or Fragment did_reference = "did:dad:iy67FstqFl_a5e-sni6yAWoj60-1E2RtzmMGjrjHaSY=" did = didering.Did(did_reference) exp_scheme = "did" exp_method = "dad" exp_idstring = "iy67FstqFl_a5e-sni6yAWoj60-1E2RtzmMGjrjHaSY=" exp_query = None exp_path = "" exp_fragment = None didAssertions(did_reference, did, exp_scheme, exp_method, exp_idstring, exp_query, exp_path, exp_fragment)
def testEmptyDid(): did_reference = "" with pytest.raises(ValueError) as ex: did = didering.Did(did_reference) assert ex.value == "Invalid DID value"