create account

Bash script - challenge. Writing API tests using the curl program by grzesiekb

View this thread on: hive.blogpeakd.comecency.com
· @grzesiekb · (edited)
$0.14
Bash script - challenge. Writing API tests using the curl program
![20229352_122422448376375_8167359585774756489_n.jpg](https://cdn.steemitimages.com/DQmZfJRTeApQmawAPeER4nDgBszXAtJeWUJ96TtWxrPnEDC/20229352_122422448376375_8167359585774756489_n.jpg)

Let’s start

#### First, Let’s check if we have curl package installed

```bash
curl -V
```

#### Preparation and start of the test

In the API for steem documentation, we can find examples of API calls using the curl program.
e.g. 

```bash 
curl -s --data '{"jsonrpc":"2.0", "method":"database_api.find_accounts", "params": {"accounts":["steemit", "grzesiekb"]}, "id":1}' https://api.steemit.com
```
I assume the API works properly if it returns a result containing 'about'

```bash
curl -s --data '{"jsonrpc":"2.0", "method":"database_api.find_accounts", "params": {"accounts":["steemit", "grzesiekb"]}, "id":1}' https://api.steemit.com | grep about -q && echo ‘find_accounts works’ || echo ‘find_accounts is not work’
```

I passed the result to the grep program, in which I check if it contains an  'about' string of characters. If the test is positive, grep returns 'find_accounts works'. If the test is negative, grep returns 'find_accounts is not work'.


#### In the near future, I'm going to present my idea for

* Authentication test (session) using the curl program.
* Authentication test (token) using the curl program.
* Reporting test results written using bash script.
* Keeping (supporting) the tests written with bash scripts.
* Summary (test in bash)
👍  , , , , , , , , , , , , , , , , , , , , , , , , ,
👎  
properties (23)
authorgrzesiekb
permlinkbash-script-challenge-writing-api-tests-using-the-curl-program
categoryutopian-io
json_metadata{"tags":["utopian-io","bash","test","curl"],"image":["https://cdn.steemitimages.com/DQmZfJRTeApQmawAPeER4nDgBszXAtJeWUJ96TtWxrPnEDC/20229352_122422448376375_8167359585774756489_n.jpg"],"app":"steemit/0.1","format":"markdown"}
created2019-09-11 08:50:03
last_update2019-09-11 13:31:57
depth0
children2
last_payout2019-09-18 08:50:03
cashout_time1969-12-31 23:59:59
total_payout_value0.071 HBD
curator_payout_value0.068 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,454
author_reputation2,800,305,353,550
root_title"Bash script - challenge. Writing API tests using the curl program"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id90,467,984
net_rshares616,847,350,996
author_curate_reward""
vote details (27)
@steemitboard ·
Congratulations @grzesiekb! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

<table><tr><td><img src="https://steemitimages.com/60x70/http://steemitboard.com/@grzesiekb/posts.png?201909110934"></td><td>You published more than 20 posts. Your next target is to reach 30 posts.</td></tr>
</table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@grzesiekb) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=grzesiekb)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>


To support your work, I also upvoted your post!


###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-grzesiekb-20190911t101308000z
categoryutopian-io
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2019-09-11 10:13:06
last_update2019-09-11 10:13:06
depth1
children0
last_payout2019-09-18 10:13:06
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length891
author_reputation38,975,615,169,260
root_title"Bash script - challenge. Writing API tests using the curl program"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id90,469,885
net_rshares0
@steemitboard ·
Congratulations @grzesiekb! You received a personal award!

<table><tr><td>https://steemitimages.com/70x70/http://steemitboard.com/@grzesiekb/birthday2.png</td><td>Happy Birthday! - You are on the Steem blockchain for 2 years!</td></tr></table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@grzesiekb) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=grzesiekb)_</sub>


###### [Vote for @Steemitboard as a witness](https://v2.steemconnect.com/sign/account-witness-vote?witness=steemitboard&approve=1) to get one more award and increased upvotes!
👍  
properties (23)
authorsteemitboard
permlinksteemitboard-notify-grzesiekb-20191212t182933000z
categoryutopian-io
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2019-12-12 18:29:33
last_update2019-12-12 18:29:33
depth1
children0
last_payout2019-12-19 18:29:33
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length624
author_reputation38,975,615,169,260
root_title"Bash script - challenge. Writing API tests using the curl program"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id93,354,560
net_rshares0
author_curate_reward""
vote details (1)