Skip to content

Commit

Permalink
Changed Request File Names for Getting Started
Browse files Browse the repository at this point in the history
and also updated function activeDID
  • Loading branch information
hadleym committed Jul 26, 2017
1 parent 23e2d42 commit de4dc9a
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 42 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions sovrin_client/agent/walleted.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ def _handleAcceptInviteResponse(self, msg):
else:
self.notifyMsgListener(" DID created in Sovrin.")

li.linkStatus = constant.LINK_STATUS_ACCEPTED
li.connection_status = constant.LINK_STATUS_ACCEPTED
rcvdAvailableClaims = body[DATA][CLAIMS_LIST_FIELD]
newAvailableClaims = self._getNewAvailableClaims(
li, rcvdAvailableClaims)
Expand Down Expand Up @@ -948,7 +948,7 @@ def _updateLinkWithLatestInfo(self, link: Link, reply):
link.remotePubkey = friendlyVerkeyToPubkey(
link.full_remote_verkey) if link.full_remote_verkey else None

link.connectionLastSynced = datetime.now()
link.connection_last_synced = datetime.now()
self.notifyMsgListener(" Connection {} synced".format(link.name))

def _pingToEndpoint(self, name, endpoint):
Expand Down
2 changes: 1 addition & 1 deletion sovrin_client/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ def _acceptConnectionInvitation(self, connectionName):
self._printConnectionAlreadyExcepted(li.name)
else:
self.print("Request not yet verified.")
if not li.connectionLastSynced:
if not li.connection_last_synced:
self.print("Connection not yet synchronized.")

if self._isConnectedToAnyEnv():
Expand Down
4 changes: 2 additions & 2 deletions sovrin_client/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@
id="show",
title="Shows content of given file",
usage="show <file-path>",
examples="show sample/faber-invitation.sovrin")
examples="show sample/faber-request.sovrin")

loadFileCmd = Command(
id="load",
title="Creates the connection",
usage="load <file-path>",
examples="load sample/faber-invitation.sovrin")
examples="load sample/faber-request.sovrin")

showConnectionCmd = Command(
id="show connection",
Expand Down
36 changes: 18 additions & 18 deletions sovrin_client/client/wallet/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def __init__(self,
self.availableClaims = [] # type: List[AvailableClaim]

self.remoteVerkey = remote_verkey
self.linkStatus = None
self.connectionLastSynced = None
self.linkLastSyncNo = None
self.connection_status = None
self.connection_last_synced = None
self.connection_last_sync_no = None

def __repr__(self):
return self.key
Expand All @@ -92,7 +92,7 @@ def isRemoteEndpointAvailable(self):

@property
def isAccepted(self):
return self.linkStatus == constant.LINK_STATUS_ACCEPTED
return self.connection_status == constant.LINK_STATUS_ACCEPTED

def __str__(self):
localIdr = self.localIdentifier if self.localIdentifier \
Expand All @@ -111,19 +111,19 @@ def __str__(self):
constant.UNKNOWN_WAITING_FOR_SYNC
if isinstance(remoteEndPoint, tuple):
remoteEndPoint = "{}:{}".format(*remoteEndPoint)
linkStatus = 'not verified, remote verkey unknown'
linkLastSynced = prettyDateDifference(self.connectionLastSynced) or \
connectionStatus = 'not verified, remote verkey unknown'
connection_last_synced = prettyDateDifference(self.connection_last_synced) or \
constant.LINK_NOT_SYNCHRONIZED

if linkLastSynced != constant.LINK_NOT_SYNCHRONIZED and \
if connection_last_synced != constant.LINK_NOT_SYNCHRONIZED and \
remoteEndPoint == constant.UNKNOWN_WAITING_FOR_SYNC:
remoteEndPoint = constant.NOT_AVAILABLE

if self.isAccepted:
trustAnchorStatus = '(confirmed)'
if self.remoteVerkey is None:
remoteVerKey = constant.REMOTE_VER_KEY_SAME_AS_ID
linkStatus = self.linkStatus
connectionStatus = self.connection_status

# TODO: The verkey would be same as the local identifier until we
# support key rotation
Expand All @@ -148,7 +148,7 @@ def __str__(self):
'Remote Verification key: ' + remoteVerKey + '\n' \
'Remote endpoint: ' + remoteEndPoint + '\n' \
'Request nonce: ' + self.invitationNonce + '\n' \
'Request status: ' + linkStatus + '\n'
'Request status: ' + connectionStatus + '\n'

optionalLinkItems = ""
if len(self.proofRequests) > 0:
Expand All @@ -159,15 +159,15 @@ def __str__(self):
if self.availableClaims:
optionalLinkItems += self.avail_claims_str()

if self.linkLastSyncNo:
optionalLinkItems += 'Last sync seq no: ' + self.linkLastSyncNo \
if self.connection_last_sync_no:
optionalLinkItems += 'Last sync seq no: ' + self.connection_last_sync_no \
+ '\n'

fixedEndingLines = 'Last synced: ' + linkLastSynced
fixedEndingLines = 'Last synced: ' + connection_last_synced

linkItems = fixedLinkItems + optionalLinkItems + fixedEndingLines
connection_items = fixedLinkItems + optionalLinkItems + fixedEndingLines
indentedLinkItems = constant.LINK_ITEM_PREFIX.join(
linkItems.splitlines())
connection_items.splitlines())
return fixedLinkHeading + indentedLinkItems

def avail_claims_str(self):
Expand All @@ -185,10 +185,10 @@ def checkIfFieldPresent(msg, searchInName, fieldName):

checkIfFieldPresent(invitationData, 'given input', 'sig')
checkIfFieldPresent(invitationData, 'given input', 'connection-request')
linkInvitation = invitationData.get("connection-request")
linkInvitationReqFields = [f.IDENTIFIER.nm, NAME, NONCE]
for fn in linkInvitationReqFields:
checkIfFieldPresent(linkInvitation, 'connection-request', fn)
connection_request = invitationData.get("connection-request")
connection_request_req_fields = [f.IDENTIFIER.nm, NAME, NONCE]
for fn in connection_request_req_fields:
checkIfFieldPresent(connection_request, 'connection-request', fn)

def getRemoteEndpoint(self, required=False):
if not self.remoteEndPoint and required:
Expand Down
2 changes: 1 addition & 1 deletion sovrin_client/test/agent/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def aliceAcceptedFaber(faberIsRunning, faberNonceForAlice, faberAdded,

@pytest.fixture(scope="module")
def faberInvitation():
return getInvitationFile('faber-invitation.sovrin')
return getInvitationFile('faber-request.sovrin')


@pytest.fixture(scope="module")
Expand Down
6 changes: 3 additions & 3 deletions sovrin_client/test/cli/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ def susanMap():
def faberMap(agentIpAddress, faberAgentPort):
ha = "{}:{}".format(agentIpAddress, faberAgentPort)
return {'inviter': 'Faber College',
'invite': "sample/faber-invitation.sovrin",
'invite-not-exists': "sample/faber-invitation.sovrin.not.exists",
'invite': "sample/faber-request.sovrin",
'invite-not-exists': "sample/faber-request.sovrin.not.exists",
'inviter-not-exists': "non-existing-inviter",
'seed': FABER_SEED.decode(),
"remote": FABER_ID,
Expand Down Expand Up @@ -809,7 +809,7 @@ def showAcceptedConnectionOut():
return [
"Connection",
"Name: {inviter}",
"DID: {identifier}",
"DID: {DID}",
"Verification key: {verkey}",
"Remote: {remote}",
"Remote Verification key: {remote-verkey}",
Expand Down
16 changes: 8 additions & 8 deletions sovrin_client/test/cli/test_command_reg_ex.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,26 @@ def test_send_get_claim_def_regex(grammar):

def testShowFileCommandRegEx(grammar):
matchedVars = getMatchedVariables(grammar,
"show sample/faber-invitation.sovrin")
"show sample/faber-request.sovrin")
assertCliTokens(matchedVars, {
"show_file": "show", "file_path": "sample/faber-invitation.sovrin"})
"show_file": "show", "file_path": "sample/faber-request.sovrin"})

matchedVars = getMatchedVariables(grammar,
"show sample/faber-invitation.sovrin ")
"show sample/faber-request.sovrin ")
assertCliTokens(matchedVars, {
"show_file": "show", "file_path": "sample/faber-invitation.sovrin"})
"show_file": "show", "file_path": "sample/faber-request.sovrin"})


def testLoadFileCommandRegEx(grammar):
matchedVars = getMatchedVariables(grammar,
"load sample/faber-invitation.sovrin")
"load sample/faber-request.sovrin")
assertCliTokens(matchedVars, {
"load_file": "load", "file_path": "sample/faber-invitation.sovrin"})
"load_file": "load", "file_path": "sample/faber-request.sovrin"})

matchedVars = getMatchedVariables(grammar,
"load sample/faber-invitation.sovrin ")
"load sample/faber-request.sovrin ")
assertCliTokens(matchedVars, {
"load_file": "load", "file_path": "sample/faber-invitation.sovrin"})
"load_file": "load", "file_path": "sample/faber-request.sovrin"})


def testShowLinkRegEx(grammar):
Expand Down
12 changes: 6 additions & 6 deletions sovrin_client/test/cli/test_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def acceptInvitation(be, do, userCli, agentMap, expect):
)
li = userCli.agent.wallet.getConnectionBy(nonce=agentMap['nonce'])
assert li
agentMap['identifier'] = li.localIdentifier
agentMap['DID'] = li.localIdentifier
agentMap['verkey'] = li.localVerkey


Expand Down Expand Up @@ -446,11 +446,11 @@ def testAliceAcceptFaberInvitationAgain(be, do, aliceCli, faberMap,
unsycedAlreadyAcceptedInviteAcceptedOut,
aliceAcceptedFaberInvitation):
li = aliceCli.activeWallet.getConnectionBy(remote=faberMap['remote'])
li.linkStatus = None
li.connection_status = None
be(aliceCli)
acceptInvitation(be, do, aliceCli, faberMap,
unsycedAlreadyAcceptedInviteAcceptedOut)
li.linkStatus = constant.LINK_STATUS_ACCEPTED
li.connection_status = constant.LINK_STATUS_ACCEPTED


# TODO: Write tests which sends request with invalid signature
Expand Down Expand Up @@ -1009,7 +1009,7 @@ def testBobReqAvailClaimsFromAgents(
# When new user/cli requests available claims from Faber,
# Transcript claim should be send as available claims
bob_faber_map = dict(faberMap)
bob_faber_map.update({'invite':'sample/faber-bob-link-invite.sovrin',
bob_faber_map.update({'invite':'sample/faber-bob-connection-request.sovrin',
'nonce': '710b78be79f29fc81335abaa4ee1c5e8'})
assertReqAvailClaims(be, do, userCli, bob_faber_map, connectedToTest,
loadInviteOut, syncedInviteAcceptedWithClaimsOut)
Expand All @@ -1020,7 +1020,7 @@ def testBobReqAvailClaimsFromAgents(
# proof request and it is verified.
bob_acme_map = dict(acmeMap)
bob_acme_map.update({"claims": "No available claims found",
'invite':'sample/acme-bob-link-invite.sovrin',
'invite':'sample/acme-bob-connection-request.sovrin',
'nonce': '810b78be79f29fc81335abaa4ee1c5e8'})
assertReqAvailClaims(be, do, userCli, bob_acme_map, connectedToTest,
loadInviteOut, unsycedAcceptedInviteWithoutClaimOut)
Expand All @@ -1029,7 +1029,7 @@ def testBobReqAvailClaimsFromAgents(
# No claims should be sent as available claims.
bob_thrift_map = dict(thriftMap)
bob_thrift_map.update({"claims": "No available claims found",
'invite':'sample/thrift-bob-link-invite.sovrin',
'invite':'sample/thrift-bob-connection-request.sovrin',
'nonce': 'ousezru20ic4yz3j074trcgthwlsnfsef'})
assertReqAvailClaims(be, do, userCli, bob_thrift_map, connectedToTest,
loadInviteOut, unsycedAcceptedInviteWithoutClaimOut)
2 changes: 1 addition & 1 deletion sovrin_client/test/cli/test_tutorial_manual.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ async def getClaim(schemaId):
setPromptAndKeyring(do, name, newKeyringOut, userMap)
do('connect test', within=3, expect=connectedToTest)
# Accept faber
do('load sample/faber-invitation.sovrin')
do('load sample/faber-request.sovrin')
syncInvite(be, do, userCLI, syncConnectionOutWithEndpoint, fMap)
do('show connection faber')
acceptInvitation(be, do, userCLI, fMap,
Expand Down

0 comments on commit de4dc9a

Please sign in to comment.