github.com/kyma-incubator/compass/components/director@v0.0.0-20230623144113-d764f56ff805/internal/domain/tombstone/fixtures_test.go (about) 1 package tombstone_test 2 3 import ( 4 "database/sql/driver" 5 6 "github.com/kyma-incubator/compass/components/director/internal/repo" 7 8 "github.com/kyma-incubator/compass/components/director/internal/domain/tombstone" 9 "github.com/kyma-incubator/compass/components/director/internal/model" 10 ) 11 12 const ( 13 tombstoneID = "tombstoneID" 14 tenantID = "b91b59f7-2563-40b2-aba9-fef726037aa3" 15 ordID = "com.compass.v1" 16 externalTenantID = "externalTenantID" 17 ) 18 19 var ( 20 appID = "appID" 21 appTemplateVersionID = "appTemplateVersionID" 22 ) 23 24 func fixEntityTombstoneForApp() *tombstone.Entity { 25 return fixEntityTombstoneWithIDForApp(tombstoneID) 26 } 27 28 func fixEntityTombstoneForAppTemplateVersion() *tombstone.Entity { 29 return fixEntityTombstoneWithIDForAppTemplateVersion(tombstoneID) 30 } 31 32 func fixEntityTombstoneWithID(id string) *tombstone.Entity { 33 return &tombstone.Entity{ 34 ID: id, 35 OrdID: ordID, 36 RemovalDate: "removalDate", 37 } 38 } 39 40 func fixEntityTombstoneWithIDForApp(id string) *tombstone.Entity { 41 tombstone := fixEntityTombstoneWithID(id) 42 tombstone.ApplicationID = repo.NewValidNullableString(appID) 43 return tombstone 44 } 45 46 func fixEntityTombstoneWithIDForAppTemplateVersion(id string) *tombstone.Entity { 47 tombstone := fixEntityTombstoneWithID(id) 48 tombstone.ApplicationTemplateVersionID = repo.NewValidNullableString(appTemplateVersionID) 49 return tombstone 50 } 51 52 func fixTombstoneModelForApp() *model.Tombstone { 53 return fixTombstoneModelWithIDForApp(tombstoneID) 54 } 55 56 func fixTombstoneModelForAppTemplateVersion() *model.Tombstone { 57 return fixTombstoneModelWithIDForAppTemplateVersion(tombstoneID) 58 } 59 60 func fixTombstoneModelWithID(id string) *model.Tombstone { 61 return &model.Tombstone{ 62 ID: id, 63 OrdID: ordID, 64 RemovalDate: "removalDate", 65 } 66 } 67 68 func fixTombstoneModelWithIDForApp(id string) *model.Tombstone { 69 tombstone := fixTombstoneModelWithID(id) 70 tombstone.ApplicationID = &appID 71 return tombstone 72 } 73 74 func fixTombstoneModelWithIDForAppTemplateVersion(id string) *model.Tombstone { 75 tombstone := fixTombstoneModelWithID(id) 76 tombstone.ApplicationTemplateVersionID = &appTemplateVersionID 77 return tombstone 78 } 79 80 func fixTombstoneModelInput() *model.TombstoneInput { 81 return &model.TombstoneInput{ 82 OrdID: ordID, 83 RemovalDate: "removalDate", 84 } 85 } 86 87 func fixTombstoneColumns() []string { 88 return []string{"ord_id", "app_id", "app_template_version_id", "removal_date", "id"} 89 } 90 91 func fixTombstoneRowForApp() []driver.Value { 92 return fixTombstoneRowWithIDForApp(tombstoneID) 93 } 94 95 func fixTombstoneRowForAppTemplateVersion() []driver.Value { 96 return fixTombstoneRowWithIDForAppTemplateVersion(tombstoneID) 97 } 98 99 func fixTombstoneRowWithIDForApp(id string) []driver.Value { 100 return []driver.Value{ordID, appID, repo.NewValidNullableString(""), "removalDate", id} 101 } 102 103 func fixTombstoneRowWithIDForAppTemplateVersion(id string) []driver.Value { 104 return []driver.Value{ordID, repo.NewValidNullableString(""), appTemplateVersionID, "removalDate", id} 105 } 106 107 func fixTombstoneUpdateArgs() []driver.Value { 108 return []driver.Value{"removalDate"} 109 }