Skip to content

Commit

Permalink
List Policies With Given Bucket Test (#1765)
Browse files Browse the repository at this point in the history
List Policies With Given Bucket Test
Incrementing the coverage
  • Loading branch information
cniackz committed Mar 24, 2022
1 parent ffa9436 commit 676420a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ jobs:
result=${result%\%}
echo "result:"
echo $result
threshold=52.1
threshold=52.7
if (( $(echo "$result >= $threshold" |bc -l) )); then
echo "It is equal or greater than threshold, passed!"
else
Expand Down
44 changes: 44 additions & 0 deletions integration/admin_api_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,47 @@ func TestRestartService(t *testing.T) {
}

}

func ListPoliciesWithBucket(bucketName string) (*http.Response, error) {
/*
Helper function to List Policies With Given Bucket
HTTP Verb: GET
URL: /bucket-policy/{bucket}
*/
request, err := http.NewRequest(
"GET", "http://localhost:9090/api/v1/bucket-policy/"+bucketName, nil)
if err != nil {
log.Println(err)
}
request.Header.Add("Cookie", fmt.Sprintf("token=%s", token))
request.Header.Add("Content-Type", "application/json")
client := &http.Client{
Timeout: 2 * time.Second,
}
response, err := client.Do(request)
return response, err
}

func TestListPoliciesWithBucket(t *testing.T) {

// Test Variables
bucketName := "testlistpolicieswithbucket"
assert := assert.New(t)

// Test
response, err := ListPoliciesWithBucket(bucketName)
assert.Nil(err)
if err != nil {
log.Println(err)
return
}
parsedResponse := inspectHTTPResponse(response)
if response != nil {
assert.Equal(
200,
response.StatusCode,
parsedResponse,
)
}

}

0 comments on commit 676420a

Please sign in to comment.