MCPcopy Create free account
hub / github.com/ericls/imgdd / tCreateStorageDefinition

Function tCreateStorageDefinition

graph/gql_test.go:42–89  ·  view source on GitHub ↗
(t *testing.T, tc *TestContext)

Source from the content-addressed store, hash-verified

40}
41
42func tCreateStorageDefinition(t *testing.T, tc *TestContext) {
43 var resp struct {
44 CreateStorageDefinition *struct {
45 Id string
46 Identifier string
47 Config model.S3StorageConfig
48 IsEnabled bool
49 Priority int
50 }
51 }
52
53 configJSON := `{
54 "bucket": "test-bucket",
55 "endpoint": "us-west-2",
56 "access": "test",
57 "secret": "test"
58 }`
59 tc.forceAuthenticate(asSiteOwner)
60 err := tc.client.Post(`
61 mutation {
62 createStorageDefinition(input: {
63 storageType: S3
64 configJSON: "`+utils.JsonEscape(configJSON)+`"
65 identifier: "test"
66 isEnabled: true
67 priority: 1
68 }) {
69 id
70 identifier
71 isEnabled
72 priority
73 config {
74 ... on S3StorageConfig {
75 bucket
76 endpoint
77 access
78 secret
79 }
80 }
81 }
82 }`, &resp)
83 require.NoError(t, err)
84 require.NotNil(t, resp.CreateStorageDefinition)
85 // check that the storage definition was created
86 storageDefinition, err := tc.storageDefRepo.GetStorageDefinitionByIdentifier("test")
87 require.NoError(t, err)
88 require.NotNil(t, storageDefinition)
89}
90
91func tCreateStorageDefinitionWithInvalidConfig(t *testing.T, tc *TestContext) {
92 var resp struct {

Callers

nothing calls this directly

Calls 3

JsonEscapeFunction · 0.92
forceAuthenticateMethod · 0.80

Tested by

no test coverage detected