mirror of
https://github.com/interviewstreet/go-jira.git
synced 2024-11-24 08:22:42 +02:00
Add positive test for project.GetPermissionScheme
This commit is contained in:
parent
4ecfcbf5da
commit
3ca90a4262
@ -55,7 +55,6 @@ func TestProjectService_ListWithOptions(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func TestProjectService_Get(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
@ -104,7 +103,7 @@ func TestProjectService_Get_NoProject(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestProjectService_GetPermissionScheme(t *testing.T) {
|
||||
func TestProjectService_GetPermissionScheme_Failure(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
testAPIEdpoint := "/rest/api/2/project/99999999/permissionscheme"
|
||||
@ -115,9 +114,9 @@ func TestProjectService_GetPermissionScheme(t *testing.T) {
|
||||
fmt.Fprint(w, nil)
|
||||
})
|
||||
|
||||
projects, resp, err := testClient.Project.GetPermissionScheme("99999999")
|
||||
if projects != nil {
|
||||
t.Errorf("Expected nil. Got %+v", projects)
|
||||
permissionScheme, resp, err := testClient.Project.GetPermissionScheme("99999999")
|
||||
if permissionScheme != nil {
|
||||
t.Errorf("Expected nil. Got %+v", permissionScheme)
|
||||
}
|
||||
|
||||
if resp.Status == "404" {
|
||||
@ -127,3 +126,33 @@ func TestProjectService_GetPermissionScheme(t *testing.T) {
|
||||
t.Errorf("Error given: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProjectService_GetPermissionScheme_Success(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
testAPIEdpoint := "/rest/api/2/project/99999999/permissionscheme"
|
||||
|
||||
testMux.HandleFunc(testAPIEdpoint, func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "GET")
|
||||
testRequestURL(t, r, testAPIEdpoint)
|
||||
fmt.Fprint(w, `{
|
||||
"expand": "permissions,user,group,projectRole,field,all",
|
||||
"id": 10201,
|
||||
"self": "https://www.example.com/rest/api/2/permissionscheme/10201",
|
||||
"name": "Project for specific-users",
|
||||
"description": "Projects that can only see for people belonging to specific-users group"
|
||||
}`)
|
||||
})
|
||||
|
||||
permissionScheme, resp, err := testClient.Project.GetPermissionScheme("99999999")
|
||||
if permissionScheme.ID != 10201 {
|
||||
t.Errorf("Expected Permission Scheme ID. Got %+v", permissionScheme)
|
||||
}
|
||||
|
||||
if resp.Status == "404" {
|
||||
t.Errorf("Expected status 404. Got %s", resp.Status)
|
||||
}
|
||||
if err != nil {
|
||||
t.Errorf("Error given: %s", err)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user