mirror of
https://github.com/passbolt/go-passbolt.git
synced 2025-09-13 14:29:09 +00:00
ad basic ci testing
This commit is contained in:
parent
28e2ccf7e4
commit
54f4b4ca23
3 changed files with 118 additions and 0 deletions
30
helper/resource_test.go
Normal file
30
helper/resource_test.go
Normal file
|
@ -0,0 +1,30 @@
|
|||
package helper
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestResourceCreate(t *testing.T) {
|
||||
id, err := CreateResource(context.TODO(), client, "", "name", "username", "https://url.lan", "password123", "a password description")
|
||||
if err != nil {
|
||||
t.Fatalf("Creating Resource %v", err)
|
||||
}
|
||||
|
||||
_, name, username, uri, password, description, err := GetResource(context.TODO(), client, id)
|
||||
if err != nil {
|
||||
t.Fatalf("Getting Resource %v", err)
|
||||
}
|
||||
|
||||
equal(t, "Name", name, "name")
|
||||
equal(t, "Username", username, "username")
|
||||
equal(t, "URI", uri, "https://url.lan")
|
||||
equal(t, "Password", password, "password123")
|
||||
equal(t, "Description", description, "a password description")
|
||||
}
|
||||
|
||||
func equal(t *testing.T, name, a, b string) {
|
||||
if a != b {
|
||||
t.Fatalf("Value %v is %v instead of %v", name, a, b)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue