@@ -20,15 +20,14 @@ 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"
|
||||
)
|
||||
|
||||
func TestAsset_Create(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
|
||||
// TODO: right now we need to invite and accept invite to get new profile.
|
||||
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
|
||||
profileID := factory.CreateUser(owner)
|
||||
|
||||
const query = `
|
||||
mutation($input: CreateAssetInput!) {
|
||||
@@ -71,7 +70,7 @@ func TestAsset_Create(t *testing.T) {
|
||||
"organizationId": owner.GetOrganizationID().String(),
|
||||
"name": "Production Database Server",
|
||||
"amount": 5,
|
||||
"ownerId": profileID.String(),
|
||||
"ownerId": profileID,
|
||||
"assetType": "VIRTUAL",
|
||||
"dataTypesStored": "Customer PII, Financial Records",
|
||||
},
|
||||
@@ -84,15 +83,14 @@ func TestAsset_Create(t *testing.T) {
|
||||
assert.Equal(t, 5, asset.Amount)
|
||||
assert.Equal(t, "VIRTUAL", asset.AssetType)
|
||||
assert.Equal(t, "Customer PII, Financial Records", asset.DataTypesStored)
|
||||
assert.Equal(t, profileID.String(), asset.Owner.ID)
|
||||
assert.Equal(t, profileID, asset.Owner.ID)
|
||||
}
|
||||
|
||||
func TestAsset_Update(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
|
||||
// TODO: right now we need to invite and accept invite to get new profile.
|
||||
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
|
||||
profileID := factory.CreateUser(owner)
|
||||
|
||||
const createQuery = `
|
||||
mutation($input: CreateAssetInput!) {
|
||||
@@ -121,7 +119,7 @@ func TestAsset_Update(t *testing.T) {
|
||||
"organizationId": owner.GetOrganizationID().String(),
|
||||
"name": "Test Asset",
|
||||
"amount": 10,
|
||||
"ownerId": profileID.String(),
|
||||
"ownerId": profileID,
|
||||
"assetType": "VIRTUAL",
|
||||
"dataTypesStored": "Test data",
|
||||
},
|
||||
@@ -172,8 +170,7 @@ func TestAsset_Delete(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
|
||||
// TODO: right now we need to invite and accept invite to get new profile.
|
||||
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
|
||||
profileID := factory.CreateUser(owner)
|
||||
|
||||
const createQuery = `
|
||||
mutation($input: CreateAssetInput!) {
|
||||
@@ -202,7 +199,7 @@ func TestAsset_Delete(t *testing.T) {
|
||||
"organizationId": owner.GetOrganizationID().String(),
|
||||
"name": "Asset to delete",
|
||||
"amount": 1,
|
||||
"ownerId": profileID.String(),
|
||||
"ownerId": profileID,
|
||||
"assetType": "VIRTUAL",
|
||||
"dataTypesStored": "None",
|
||||
},
|
||||
@@ -237,8 +234,7 @@ func TestAsset_List(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
|
||||
// TODO: right now we need to invite and accept invite to get new profile.
|
||||
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
|
||||
profileID := factory.CreateUser(owner)
|
||||
|
||||
// Create multiple assets
|
||||
for i := 0; i < 3; i++ {
|
||||
@@ -269,7 +265,7 @@ func TestAsset_List(t *testing.T) {
|
||||
"organizationId": owner.GetOrganizationID().String(),
|
||||
"name": fmt.Sprintf("Asset %c", 'A'+i),
|
||||
"amount": i + 1,
|
||||
"ownerId": profileID.String(),
|
||||
"ownerId": profileID,
|
||||
"assetType": "VIRTUAL",
|
||||
"dataTypesStored": "Test data",
|
||||
},
|
||||
@@ -324,8 +320,7 @@ func TestAsset_Types(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
|
||||
// TODO: right now we need to invite and accept invite to get new profile.
|
||||
profileID := testutil.NewClientInOrg(t, testutil.RoleViewer, owner).GetProfileID()
|
||||
profileID := factory.CreateUser(owner)
|
||||
|
||||
assetTypes := []string{"PHYSICAL", "VIRTUAL"}
|
||||
|
||||
@@ -360,7 +355,7 @@ func TestAsset_Types(t *testing.T) {
|
||||
"organizationId": owner.GetOrganizationID().String(),
|
||||
"name": "Asset " + assetType,
|
||||
"amount": 1,
|
||||
"ownerId": profileID.String(),
|
||||
"ownerId": profileID,
|
||||
"assetType": assetType,
|
||||
"dataTypesStored": "Test data",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user