mirror of
https://github.com/passbolt/go-passbolt.git
synced 2025-05-10 01:48:22 +00:00
Automatically Skip integration tests if no REG_URL is set
This commit is contained in:
parent
c3c816d42c
commit
e41aaa19ac
2 changed files with 11 additions and 0 deletions
|
@ -6,6 +6,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestResourceCreate(t *testing.T) {
|
func TestResourceCreate(t *testing.T) {
|
||||||
|
// Skip integration tests if no client is available
|
||||||
|
if client == nil {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
id, err := CreateResource(context.TODO(), client, "", "name", "username", "https://url.lan", "password123", "a password description")
|
id, err := CreateResource(context.TODO(), client, "", "name", "username", "https://url.lan", "password123", "a password description")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("Creating Resource %v", err)
|
t.Fatalf("Creating Resource %v", err)
|
||||||
|
|
|
@ -15,6 +15,13 @@ var client *api.Client
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
url := os.Getenv("REG_URL")
|
url := os.Getenv("REG_URL")
|
||||||
|
|
||||||
|
// If we don't have a URL for Creating a user, Skip all integration tests by not Providing a client
|
||||||
|
if url == "" {
|
||||||
|
fmt.Println("REG_URL Env Variable Empty, Skipping integration tests")
|
||||||
|
os.Exit(m.Run())
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Printf("Registering with url: %v\n", url)
|
fmt.Printf("Registering with url: %v\n", url)
|
||||||
userID, token, err := ParseInviteUrl(url)
|
userID, token, err := ParseInviteUrl(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue