kopia lustrzana https://github.com/reiver/greatape
test(app): ✅ add profile test
rodzic
5e1023110b
commit
6145c7ef79
|
@ -0,0 +1,35 @@
|
|||
package tests
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
func TestProfile(t *testing.T) {
|
||||
id := uuid.New().String()
|
||||
|
||||
resp, err := Post("/api/v1/signup", Payload{
|
||||
"email": fmt.Sprintf("%s@%s", id, DOMAIN),
|
||||
"password": "123456",
|
||||
"username": id,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
t.FailNow()
|
||||
}
|
||||
|
||||
resp, err = Get(fmt.Sprintf("/u/%s", id))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
t.FailNow()
|
||||
}
|
||||
}
|
Ładowanie…
Reference in New Issue