@@ -21,6 +21,7 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
@@ -99,7 +100,7 @@ func createAuditForNC(t *testing.T, owner *testutil.Client, name string) string
|
||||
func TestNonconformity_Create(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
|
||||
profileID := factory.CreateUser(owner)
|
||||
auditID := createAuditForNC(t, owner, "NC Test Audit")
|
||||
|
||||
query := `
|
||||
@@ -142,7 +143,7 @@ func TestNonconformity_Create(t *testing.T) {
|
||||
"auditId": auditID,
|
||||
"rootCause": "Insufficient access controls",
|
||||
"correctiveAction": "Implement MFA",
|
||||
"ownerId": profileID.String(),
|
||||
"ownerId": profileID,
|
||||
"status": "OPEN",
|
||||
},
|
||||
}, &result)
|
||||
@@ -158,7 +159,7 @@ func TestNonconformity_Create(t *testing.T) {
|
||||
func TestNonconformity_Update(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
|
||||
profileID := factory.CreateUser(owner)
|
||||
auditID := createAuditForNC(t, owner, "NC Update Test Audit")
|
||||
|
||||
// Create a nonconformity to update
|
||||
@@ -190,7 +191,7 @@ func TestNonconformity_Update(t *testing.T) {
|
||||
"referenceId": fmt.Sprintf("NC-UPDATE-%d", time.Now().UnixNano()),
|
||||
"auditId": auditID,
|
||||
"rootCause": "Original root cause",
|
||||
"ownerId": profileID.String(),
|
||||
"ownerId": profileID,
|
||||
"status": "OPEN",
|
||||
},
|
||||
}, &createResult)
|
||||
@@ -241,7 +242,7 @@ func TestNonconformity_Update(t *testing.T) {
|
||||
func TestNonconformity_Delete(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
|
||||
profileID := factory.CreateUser(owner)
|
||||
auditID := createAuditForNC(t, owner, "NC Delete Test Audit")
|
||||
|
||||
// Create a nonconformity to delete
|
||||
@@ -273,7 +274,7 @@ func TestNonconformity_Delete(t *testing.T) {
|
||||
"referenceId": fmt.Sprintf("NC-DELETE-%d", time.Now().UnixNano()),
|
||||
"auditId": auditID,
|
||||
"rootCause": "Test root cause",
|
||||
"ownerId": profileID.String(),
|
||||
"ownerId": profileID,
|
||||
"status": "OPEN",
|
||||
},
|
||||
}, &createResult)
|
||||
@@ -306,7 +307,7 @@ func TestNonconformity_Delete(t *testing.T) {
|
||||
func TestNonconformity_List(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
|
||||
profileID := factory.CreateUser(owner)
|
||||
auditID := createAuditForNC(t, owner, "NC List Test Audit")
|
||||
|
||||
// Create multiple nonconformities
|
||||
@@ -339,7 +340,7 @@ func TestNonconformity_List(t *testing.T) {
|
||||
"referenceId": fmt.Sprintf("NC-LIST-%d-%d", i, time.Now().UnixNano()),
|
||||
"auditId": auditID,
|
||||
"rootCause": fmt.Sprintf("Root cause %d", i),
|
||||
"ownerId": profileID.String(),
|
||||
"ownerId": profileID,
|
||||
"status": "OPEN",
|
||||
},
|
||||
}, &createResult)
|
||||
@@ -390,7 +391,7 @@ func TestNonconformity_List(t *testing.T) {
|
||||
func TestNonconformity_StatusValues(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
|
||||
profileID := factory.CreateUser(owner)
|
||||
auditID := createAuditForNC(t, owner, "NC Status Test Audit")
|
||||
|
||||
statuses := []string{"OPEN", "IN_PROGRESS", "CLOSED"}
|
||||
@@ -427,7 +428,7 @@ func TestNonconformity_StatusValues(t *testing.T) {
|
||||
"referenceId": fmt.Sprintf("NC-STATUS-%s-%d", status, time.Now().UnixNano()),
|
||||
"auditId": auditID,
|
||||
"rootCause": "Test root cause",
|
||||
"ownerId": profileID.String(),
|
||||
"ownerId": profileID,
|
||||
"status": status,
|
||||
},
|
||||
}, &result)
|
||||
|
||||
Reference in New Issue
Block a user