Feat: add preshared key check
This commit is contained in:
@@ -21,9 +21,22 @@ type loginPayload struct {
|
||||
func Test_01_Login(t *testing.T) {
|
||||
client = resty.New()
|
||||
|
||||
t.Run("check preshared key failed", func(t *testing.T) {
|
||||
resp, err := client.R().
|
||||
SetBody(`{"userId": "testuser1"}`).
|
||||
Post("http://localhost:8080/auth/gen-login-url")
|
||||
if err != nil {
|
||||
t.Fatal("request failed")
|
||||
}
|
||||
if resp.StatusCode() != http.StatusUnauthorized {
|
||||
t.Fatal("preshared key check should failed")
|
||||
}
|
||||
})
|
||||
|
||||
var payload genLoginUrlPayload
|
||||
resp, err := client.R().
|
||||
SetBody(`{"userId": "testuser1"}`).
|
||||
SetAuthToken("poop").
|
||||
SetResult(&payload).
|
||||
Post("http://localhost:8080/auth/gen-login-url")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user