Skip to content

Commit

Permalink
chore: add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
si3nloong committed Sep 22, 2021
1 parent 0902135 commit 2462dc8
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions v3/rm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ func mockRmClient() *Client {
)
}

func emptyRmClient() *Client {
pk, _ := ioutil.ReadFile("../test/pk.pem")
pub, _ := ioutil.ReadFile("../test/server_pub.pem")
return NewClient(Config{
PrivateKey: pk,
PublicKey: pub,
StoreID: "xxx",
})
}

func TestRmClient(t *testing.T) {
ctx := context.Background()
client := mockRmClient()
Expand Down Expand Up @@ -95,4 +105,11 @@ func TestRmClient(t *testing.T) {
require.NotEmpty(t, resp.Item.QrCodeURL)
}

// expecting error
{
var emptyClient = emptyRmClient()
stores, err := emptyClient.GetStores(ctx)
require.Error(t, err)
require.Nil(t, stores)
}
}

0 comments on commit 2462dc8

Please sign in to comment.