Skip to content

Commit

Permalink
fix deploySC test file
Browse files Browse the repository at this point in the history
  • Loading branch information
pivilartisant committed Dec 4, 2024
1 parent 7bd1cc2 commit 26d01a9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 24 deletions.
28 changes: 8 additions & 20 deletions api/test/robot_tests/cmd/cmd.robot
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,18 @@ POST /cmd/read-only/executesc
Should Contain string(${response.json()}) TestSC is deployed at

POST a Smart Contract
${base64encodedSc}= Get File For DeploySc ${CURDIR}/smart_contract_base64.txt
${data}= Create Dictionary
... smartContract=${base64encodedSc}
... maxCoins="3000000000000"
... coins="300000000000"
... fee="1000000000"
... parameters=""
... description=""
${file}= Create Dictionary
${response}= POST ${API_URL}/cmd/deploySC data=${data} files=${file} expected_status=any
... nickname=${WALLET_NICKNAME}
... smartContract=${SMART_CONTRACT_BYTECODE}
... maxCoins=3000000000000
... coins=300000000000
... fee=1000000000
${headers}= Create Dictionary Content-Type=application/json
${response}= POST ${API_URL}/cmd/deploySC json=${data} headers=${headers} expected_status=any
Log To Console json response: ${response.json()} # Print the response content to the test log for debugging

Should Be Equal As Integers ${response.status_code} ${STATUS_OK} # Assert the status code is 200 OK
Should Contain ${response.json()['firstEvent']['data']} TestSC is deployed at
Should Contain ${response.json()['firstEvent']['data']} Contract deployed at address

${sc_address}= Get SC address ${response.json()['firstEvent']['data']}
Set Global Variable ${DEPLOYED_SC_ADDR} ${sc_address}
Expand Down Expand Up @@ -113,16 +111,6 @@ POST /cmd/executeFunction async

# Error cases

POST /cmd/deploySC with invalid datastore
${sc}= Get File For Streaming Upload ${CURDIR}/../../testSC/build/main-testSC.wasm
${data}= Create Dictionary walletNickname=${WALLET_NICKNAME} datastore=invalid fee=10000000
${file}= Create Dictionary smartContract=${sc}
${response}= POST
... ${API_URL}/cmd/deploySC
... data=${data}
... files=${file}
... expected_status=${STATUS_BAD_REQUEST}
Should Be Equal ${response.json()["message"]} illegal base64 data at input byte 4

POST /cmd/executeFunction with invalid address
${randomID}= Generate Random String 10
Expand Down
5 changes: 1 addition & 4 deletions api/test/robot_tests/cmd/variables.resource
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
*** Variables ***
${DEPLOYED_SC_ADDR} ${EMPTY}


${base64encodedSc} <your_base64_encoded_string_here>
${DEPLOYED_SC_ADDR} ${EMPTY}
Loading

0 comments on commit 26d01a9

Please sign in to comment.