-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: additional fields for project keys
- Loading branch information
Showing
2 changed files
with
164 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,38 +18,91 @@ func TestProjectKeysService_List(t *testing.T) { | |
assertMethod(t, "GET", r) | ||
w.Header().Set("Content-Type", "application/json") | ||
w.Header().Set("Link", "</api/0/projects/the-interstellar-jurisdiction/pump-station/keys/?&cursor=0:0:1>; rel=\"previous\"; results=\"true\"; cursor=\"0:0:1\", </api/0/projects/the-interstellar-jurisdiction/pump-station/keys/?&cursor=1584513610301:0:1>; rel=\"next\"; results=\"false\"; cursor=\"1584513610301:0:1\"") | ||
fmt.Fprint(w, `[{ | ||
"browserSdk": { | ||
"choices": [ | ||
[ | ||
"latest", | ||
"latest" | ||
], | ||
[ | ||
"4.x", | ||
"4.x" | ||
fmt.Fprint(w, `[ | ||
{ | ||
"id": "60120449b6b1d5e45f75561e6dabd80b", | ||
"name": "Liked Pegasus", | ||
"label": "Liked Pegasus", | ||
"public": "60120449b6b1d5e45f75561e6dabd80b", | ||
"secret": "189485c3b8ccf582bf5e12c530ef8858", | ||
"projectId": 4505281256090153, | ||
"isActive": true, | ||
"rateLimit": { | ||
"window": 7200, | ||
"count": 1000 | ||
}, | ||
"dsn": { | ||
"secret": "https://a785682ddda742d7a8a4088810e67701:bcd99b3790b3441c85ce4b1eaa854f66@o4504765715316736.ingest.sentry.io/4505281256090153", | ||
"public": "https://a785682ddda742d7a8a4088810e67791@o4504765715316736.ingest.sentry.io/4505281256090153", | ||
"csp": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/csp-report/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
"security": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/security/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
"minidump": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/minidump/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
"nel": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/nel/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
"unreal": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/unreal/a785682ddda719b7a8a4011110d75598/", | ||
"cdn": "https://js.sentry-cdn.com/a785682ddda719b7a8a4011110d75598.min.js", | ||
"crons": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/crons/___MONITOR_SLUG___/a785682ddda719b7a8a4011110d75598/" | ||
}, | ||
"browserSdkVersion": "7.x", | ||
"browserSdk": { | ||
"choices": [ | ||
[ | ||
"latest", | ||
"latest" | ||
], | ||
[ | ||
"7.x", | ||
"7.x" | ||
] | ||
] | ||
] | ||
}, | ||
"dateCreated": "2023-06-21T19:50:26.036254Z", | ||
"dynamicSdkLoaderOptions": { | ||
"hasReplay": true, | ||
"hasPerformance": true, | ||
"hasDebug": true | ||
} | ||
}, | ||
"browserSdkVersion": "4.x", | ||
"dateCreated": "2018-09-20T15:48:07.397Z", | ||
"dsn": { | ||
"cdn": "https://sentry.io/js-sdk-loader/cfc7b0341c6e4f6ea1a9d256a30dba00.min.js", | ||
"csp": "https://sentry.io/api/2/csp-report/?sentry_key=cfc7b0341c6e4f6ea1a9d256a30dba00", | ||
"minidump": "https://sentry.io/api/2/minidump/?sentry_key=cfc7b0341c6e4f6ea1a9d256a30dba00", | ||
"public": "https://[email protected]/2", | ||
"secret": "https://cfc7b0341c6e4f6ea1a9d256a30dba00:[email protected]/2", | ||
"security": "https://sentry.io/api/2/security/?sentry_key=cfc7b0341c6e4f6ea1a9d256a30dba00" | ||
}, | ||
"id": "cfc7b0341c6e4f6ea1a9d256a30dba00", | ||
"isActive": true, | ||
"label": "Fabulous Key", | ||
"name": "Fabulous Key", | ||
"projectId": 2, | ||
"public": "cfc7b0341c6e4f6ea1a9d256a30dba00", | ||
"rateLimit": null, | ||
"secret": "a07dcd97aa56481f82aeabaed43ca448" | ||
}]`) | ||
{ | ||
"id": "da8d69cb17e80677b76e08fde4656b93", | ||
"name": "Bold Oarfish", | ||
"label": "Bold Oarfish", | ||
"public": "da8d69cb17e80677b76e08fde4656b93", | ||
"secret": "5c241ebc42ccfbec281cbefbedc7ab96", | ||
"projectId": 4505281256090153, | ||
"isActive": true, | ||
"rateLimit": null, | ||
"dsn": { | ||
"secret": "https://a785682ddda742d7a8a4088810e67701:bcd99b3790b3441c85ce4b1eaa854f66@o4504765715316736.ingest.sentry.io/4505281256090153", | ||
"public": "https://a785682ddda742d7a8a4088810e67791@o4504765715316736.ingest.sentry.io/4505281256090153", | ||
"csp": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/csp-report/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
"security": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/security/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
"minidump": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/minidump/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
"nel": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/nel/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
"unreal": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/unreal/a785682ddda719b7a8a4011110d75598/", | ||
"cdn": "https://js.sentry-cdn.com/a785682ddda719b7a8a4011110d75598.min.js", | ||
"crons": "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/crons/___MONITOR_SLUG___/a785682ddda719b7a8a4011110d75598/" | ||
}, | ||
"browserSdkVersion": "7.x", | ||
"browserSdk": { | ||
"choices": [ | ||
[ | ||
"latest", | ||
"latest" | ||
], | ||
[ | ||
"7.x", | ||
"7.x" | ||
] | ||
] | ||
}, | ||
"dateCreated": "2023-06-21T19:50:26.036254Z", | ||
"dynamicSdkLoaderOptions": { | ||
"hasReplay": true, | ||
"hasPerformance": true, | ||
"hasDebug": true | ||
} | ||
} | ||
]`) | ||
}) | ||
|
||
ctx := context.Background() | ||
|
@@ -58,22 +111,63 @@ func TestProjectKeysService_List(t *testing.T) { | |
|
||
expected := []*ProjectKey{ | ||
{ | ||
ID: "cfc7b0341c6e4f6ea1a9d256a30dba00", | ||
Name: "Fabulous Key", | ||
Label: "Fabulous Key", | ||
Public: "cfc7b0341c6e4f6ea1a9d256a30dba00", | ||
Secret: "a07dcd97aa56481f82aeabaed43ca448", | ||
ProjectID: json.Number("2"), | ||
ID: "60120449b6b1d5e45f75561e6dabd80b", | ||
Name: "Liked Pegasus", | ||
Label: "Liked Pegasus", | ||
Public: "60120449b6b1d5e45f75561e6dabd80b", | ||
Secret: "189485c3b8ccf582bf5e12c530ef8858", | ||
ProjectID: json.Number("4505281256090153"), | ||
IsActive: true, | ||
RateLimit: &ProjectKeyRateLimit{ | ||
Window: 7200, | ||
Count: 1000, | ||
}, | ||
DSN: ProjectKeyDSN{ | ||
Secret: "https://cfc7b0341c6e4f6ea1a9d256a30dba00:[email protected]/2", | ||
Public: "https://[email protected]/2", | ||
CSP: "https://sentry.io/api/2/csp-report/?sentry_key=cfc7b0341c6e4f6ea1a9d256a30dba00", | ||
Security: "https://sentry.io/api/2/security/?sentry_key=cfc7b0341c6e4f6ea1a9d256a30dba00", | ||
Minidump: "https://sentry.io/api/2/minidump/?sentry_key=cfc7b0341c6e4f6ea1a9d256a30dba00", | ||
CDN: "https://sentry.io/js-sdk-loader/cfc7b0341c6e4f6ea1a9d256a30dba00.min.js", | ||
Secret: "https://a785682ddda742d7a8a4088810e67701:bcd99b3790b3441c85ce4b1eaa854f66@o4504765715316736.ingest.sentry.io/4505281256090153", | ||
Public: "https://a785682ddda742d7a8a4088810e67791@o4504765715316736.ingest.sentry.io/4505281256090153", | ||
CSP: "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/csp-report/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
Security: "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/security/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
Minidump: "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/minidump/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
NEL: "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/nel/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
Unreal: "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/unreal/a785682ddda719b7a8a4011110d75598/", | ||
CDN: "https://js.sentry-cdn.com/a785682ddda719b7a8a4011110d75598.min.js", | ||
Crons: "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/crons/___MONITOR_SLUG___/a785682ddda719b7a8a4011110d75598/", | ||
}, | ||
BrowserSDKVersion: "7.x", | ||
DateCreated: mustParseTime("2023-06-21T19:50:26.036254Z"), | ||
DynamicSDKLoaderOptions: ProjectKeyDynamicSDKLoaderOptions{ | ||
HasReplay: true, | ||
HasPerformance: true, | ||
HasDebugFiles: true, | ||
}, | ||
}, | ||
{ | ||
ID: "da8d69cb17e80677b76e08fde4656b93", | ||
Name: "Bold Oarfish", | ||
Label: "Bold Oarfish", | ||
Public: "da8d69cb17e80677b76e08fde4656b93", | ||
Secret: "5c241ebc42ccfbec281cbefbedc7ab96", | ||
ProjectID: json.Number("4505281256090153"), | ||
IsActive: true, | ||
RateLimit: nil, | ||
DSN: ProjectKeyDSN{ | ||
Secret: "https://a785682ddda742d7a8a4088810e67701:bcd99b3790b3441c85ce4b1eaa854f66@o4504765715316736.ingest.sentry.io/4505281256090153", | ||
Public: "https://a785682ddda742d7a8a4088810e67791@o4504765715316736.ingest.sentry.io/4505281256090153", | ||
CSP: "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/csp-report/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
Security: "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/security/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
Minidump: "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/minidump/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
NEL: "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/nel/?sentry_key=a785682ddda719b7a8a4011110d75598", | ||
Unreal: "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/unreal/a785682ddda719b7a8a4011110d75598/", | ||
CDN: "https://js.sentry-cdn.com/a785682ddda719b7a8a4011110d75598.min.js", | ||
Crons: "https://o4504765715316736.ingest.sentry.io/api/4505281256090153/crons/___MONITOR_SLUG___/a785682ddda719b7a8a4011110d75598/", | ||
}, | ||
BrowserSDKVersion: "7.x", | ||
DateCreated: mustParseTime("2023-06-21T19:50:26.036254Z"), | ||
DynamicSDKLoaderOptions: ProjectKeyDynamicSDKLoaderOptions{ | ||
HasReplay: true, | ||
HasPerformance: true, | ||
HasDebugFiles: true, | ||
}, | ||
DateCreated: mustParseTime("2018-09-20T15:48:07.397Z"), | ||
}, | ||
} | ||
assert.Equal(t, expected, projectKeys) | ||
|
@@ -145,7 +239,8 @@ func TestProjectKeysService_Create(t *testing.T) { | |
Minidump: "https://sentry.io/api/2/minidump/?sentry_key=cfc7b0341c6e4f6ea1a9d256a30dba00", | ||
CDN: "https://sentry.io/js-sdk-loader/cfc7b0341c6e4f6ea1a9d256a30dba00.min.js", | ||
}, | ||
DateCreated: mustParseTime("2018-09-20T15:48:07.397Z"), | ||
BrowserSDKVersion: "4.x", | ||
DateCreated: mustParseTime("2018-09-20T15:48:07.397Z"), | ||
} | ||
assert.Equal(t, expected, projectKey) | ||
} | ||
|
@@ -216,7 +311,8 @@ func TestProjectKeysService_Update(t *testing.T) { | |
Minidump: "https://sentry.io/api/2/minidump/?sentry_key=cfc7b0341c6e4f6ea1a9d256a30dba00", | ||
CDN: "https://sentry.io/js-sdk-loader/cfc7b0341c6e4f6ea1a9d256a30dba00.min.js", | ||
}, | ||
DateCreated: mustParseTime("2018-09-20T15:48:07.397Z"), | ||
BrowserSDKVersion: "4.x", | ||
DateCreated: mustParseTime("2018-09-20T15:48:07.397Z"), | ||
} | ||
assert.Equal(t, expected, projectKey) | ||
} | ||
|
@@ -300,7 +396,8 @@ func TestProjectKeysService_Update_RateLimit(t *testing.T) { | |
Minidump: "https://sentry.io/api/2/minidump/?sentry_key=cfc7b0341c6e4f6ea1a9d256a30dba00", | ||
CDN: "https://sentry.io/js-sdk-loader/cfc7b0341c6e4f6ea1a9d256a30dba00.min.js", | ||
}, | ||
DateCreated: mustParseTime("2018-09-20T15:48:07.397Z"), | ||
BrowserSDKVersion: "4.x", | ||
DateCreated: mustParseTime("2018-09-20T15:48:07.397Z"), | ||
} | ||
assert.Equal(t, expected, projectKey) | ||
} | ||
|