Skip to content

Commit 676420a

Browse files
authored
List Policies With Given Bucket Test (#1765)
List Policies With Given Bucket Test Incrementing the coverage
1 parent ffa9436 commit 676420a

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

.github/workflows/jobs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ jobs:
988988
result=${result%\%}
989989
echo "result:"
990990
echo $result
991-
threshold=52.1
991+
threshold=52.7
992992
if (( $(echo "$result >= $threshold" |bc -l) )); then
993993
echo "It is equal or greater than threshold, passed!"
994994
else

integration/admin_api_integration_test.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,47 @@ func TestRestartService(t *testing.T) {
169169
}
170170

171171
}
172+
173+
func ListPoliciesWithBucket(bucketName string) (*http.Response, error) {
174+
/*
175+
Helper function to List Policies With Given Bucket
176+
HTTP Verb: GET
177+
URL: /bucket-policy/{bucket}
178+
*/
179+
request, err := http.NewRequest(
180+
"GET", "http://localhost:9090/api/v1/bucket-policy/"+bucketName, nil)
181+
if err != nil {
182+
log.Println(err)
183+
}
184+
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
185+
request.Header.Add("Content-Type", "application/json")
186+
client := &http.Client{
187+
Timeout: 2 * time.Second,
188+
}
189+
response, err := client.Do(request)
190+
return response, err
191+
}
192+
193+
func TestListPoliciesWithBucket(t *testing.T) {
194+
195+
// Test Variables
196+
bucketName := "testlistpolicieswithbucket"
197+
assert := assert.New(t)
198+
199+
// Test
200+
response, err := ListPoliciesWithBucket(bucketName)
201+
assert.Nil(err)
202+
if err != nil {
203+
log.Println(err)
204+
return
205+
}
206+
parsedResponse := inspectHTTPResponse(response)
207+
if response != nil {
208+
assert.Equal(
209+
200,
210+
response.StatusCode,
211+
parsedResponse,
212+
)
213+
}
214+
215+
}

0 commit comments

Comments
 (0)