Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
90 changed files
with
1,549 additions
and
883 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,3 +79,4 @@ cmd/gptn/ | |
gptn/ | ||
dag/transactions.rlp.new | ||
dag/transactions.rlp | ||
ofile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
*** Settings *** | ||
Test Setup beforeVote | ||
Library Collections | ||
Resource ../pubVariables.robot | ||
Resource ../pubFuncs.robot | ||
Resource ../setups.robot | ||
|
||
*** Test Cases *** | ||
mediatorvote | ||
Given user unlock its account succeed | ||
When create proof existence | ||
and wait transaction packaged | ||
Then check proof existence | ||
|
||
*** Keywords *** | ||
user unlock its account succeed | ||
${respJson}= unlockAccount ${userAccount} | ||
log ${respJson} | ||
Dictionary Should Contain Key ${respJson} result | ||
Should Be Equal ${respJson["result"]} ${true} | ||
|
||
create proof existence | ||
Log create proof existence | ||
${args}= Create List | ||
${params}= Create List ${userAccount} ${maindata} ${extradata} ${reference} ${fee} | ||
${resp}= sendRpcPost ${createProofExistence} ${params} create proof existence | ||
${res} set variable ${resp["result"]} | ||
log ${res} INFO | ||
|
||
wait transaction packaged | ||
Log wait for transaction being packaged | ||
Sleep 15 | ||
|
||
check proof existence | ||
Log check proof existence | ||
${args}= Create List | ||
${params}= Create List ${reference} | ||
${resp}= sendRpcPost ${checkProofExistence} ${params} check proof existence | ||
${res}= Get From Dictionary ${resp} result | ||
${refs}= Get From List ${res} 0 | ||
${ref} set variable ${refs["reference"]} | ||
Should Be Equal ${ref} ${reference} | ||
log ${ref} INFO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
#pkill gptn | ||
#tskill gptn | ||
#cd ../../cmd/gptn && go build | ||
cd ../../ | ||
#rm -rf ./bdd/application/node* | ||
#cp ./cmd/gptn/gptn ./bdd/application/node | ||
cd ./bdd/application/node | ||
chmod +x gptn | ||
|
||
# new genesis | ||
./gptn newgenesis "" fasle << EOF | ||
y | ||
1 | ||
1 | ||
EOF | ||
|
||
# edit toml file | ||
tomlFile="ptn-config.toml" | ||
if [ -e "$tomlFile" ]; then | ||
#file already exist, modify | ||
sed -i "s/HTTPPort = 8545/HTTPPort = 8600/g" $tomlFile | ||
|
||
else | ||
#file not found, new file | ||
echo "no $tomlFile" | ||
exit -1 | ||
fi | ||
|
||
# gptn init | ||
./gptn init << EOF | ||
1 | ||
EOF | ||
|
||
# start gptn | ||
nohup ./gptn & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
*** Settings *** | ||
Resource pubVariables.robot | ||
|
||
*** Keywords *** | ||
newAccount | ||
${params}= Create List 1 | ||
${respJson}= sendRpcPost personal_newAccount ${params} newAccount | ||
Dictionary Should Contain Key ${respJson} result | ||
[Return] ${respJson["result"]} | ||
|
||
transferPTN | ||
[Arguments] ${to} | ||
${params}= Create List ${tokenHolder} ${to} ${amount} ${fee} ${null} | ||
... ${pwd} | ||
${respJson}= sendRpcPost ${transerferPTNMethod} ${params} transferPTN | ||
Dictionary Should Contain Key ${respJson} result | ||
|
||
getBalance | ||
[Arguments] ${addr} | ||
${params}= Create List ${addr} | ||
${respJson}= sendRpcPost ${getBalanceMethod} ${params} getBalance | ||
Dictionary Should Contain Key ${respJson} result | ||
Dictionary Should Contain Key ${respJson["result"]} PTN | ||
[Return] ${respJson["result"]["PTN"]} | ||
|
||
unlockAccount | ||
[Arguments] ${addr} | ||
${params}= Create List ${addr} ${pwd} ${600000000} | ||
${respJson}= sendRpcPost ${unlockAccountMethod} ${params} unlockAccount | ||
[Return] ${respJson} | ||
|
||
sendRpcPost | ||
[Arguments] ${method} ${params} ${alias} | ||
${header}= Create Dictionary Content-Type application/json | ||
${data} Create Dictionary jsonrpc=2.0 method=${method} params=${params} id=1 | ||
Create Session ${alias} http://127.0.0.1:8600 | ||
${resp} Post Request ${alias} http://127.0.0.1:8600 data=${data} headers=${header} | ||
${respJson} To Json ${resp.content} | ||
[Return] ${respJson} | ||
|
||
queryTokenHolder | ||
${args}= Create List | ||
${params}= Create List | ||
${respJson}= sendRpcPost ${personalListAccountsMethod} ${params} queryTokenHolder | ||
Dictionary Should Contain Key ${respJson} result | ||
${accounts}= Get From Dictionary ${respJson} result | ||
${firstAddr}= Get From List ${accounts} 0 | ||
Set Global Variable ${tokenHolder} ${firstAddr} | ||
log ${tokenHolder} | ||
|
||
wait for transaction being packaged | ||
Log wait for transaction being packaged | ||
Sleep 6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
*** Settings *** | ||
Library RequestsLibrary | ||
|
||
*** Variables *** | ||
${host} http://localhost:8600/ | ||
# methods | ||
${transerferPTNMethod} wallet_transferPtn | ||
${getBalanceMethod} wallet_getBalance | ||
${personalListAccountsMethod} personal_listAccounts | ||
${unlockAccountMethod} personal_unlockAccount | ||
${createProofExistence} wallet_createProofOfExistenceTx | ||
${checkProofExistence} wallet_getProofOfExistencesByRef | ||
# common variables | ||
${userAccount} ${null} | ||
${tokenHolder} ${null} | ||
${maindata} maindata | ||
${extradata} extradata | ||
${reference} A | ||
${amount} 10000 | ||
${fee} 1 | ||
${pwd} 1 | ||
${duration} 600000000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
*** Settings *** | ||
Resource pubVariables.robot | ||
Resource pubFuncs.robot | ||
Library Collections | ||
|
||
*** Keywords *** | ||
beforeVote | ||
queryTokenHolder | ||
newAccounts | ||
transferPTNToUser | ||
|
||
newAccounts | ||
# create a user for the poll | ||
${user1}= newAccount | ||
Set Global Variable ${userAccount} ${user1} | ||
|
||
transferPTNToUser | ||
# transfer PTN to user for the poll | ||
transferPTN ${userAccount} | ||
Log wait for tx being packaged into unit | ||
Sleep 5 # should sleep, because transaction has not been packaged into unit | ||
${balance}= getBalance ${userAccount} | ||
Should Be Equal ${balance} ${amount} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.