@ -127,16 +127,14 @@ func TestAPIOrgDeny(t *testing.T) {
setting . Service . RequireSignInView = false
} ( )
token := getUserToken ( t , "user1" , auth_model . AccessTokenScopeReadOrg )
orgName := "user1_org"
req := NewRequestf ( t , "GET" , "/api/v1/orgs/%s ?token=%s ", orgName , token )
req := NewRequestf ( t , "GET" , "/api/v1/orgs/%s" , orgName )
MakeRequest ( t , req , http . StatusNotFound )
req = NewRequestf ( t , "GET" , "/api/v1/orgs/%s/repos ?token=%s ", orgName , token )
req = NewRequestf ( t , "GET" , "/api/v1/orgs/%s/repos ", orgName )
MakeRequest ( t , req , http . StatusNotFound )
req = NewRequestf ( t , "GET" , "/api/v1/orgs/%s/members ?token=%s ", orgName , token )
req = NewRequestf ( t , "GET" , "/api/v1/orgs/%s/members ", orgName )
MakeRequest ( t , req , http . StatusNotFound )
} )
}
@ -146,16 +144,24 @@ func TestAPIGetAll(t *testing.T) {
token := getUserToken ( t , "user1" , auth_model . AccessTokenScopeReadOrg )
// accessing with a token will return all orgs
req := NewRequestf ( t , "GET" , "/api/v1/orgs?token=%s" , token )
resp := MakeRequest ( t , req , http . StatusOK )
var apiOrgList [ ] * api . Organization
DecodeJSON ( t , resp , & apiOrgList )
// accessing with a token will return all orgs
DecodeJSON ( t , resp , & apiOrgList )
assert . Len ( t , apiOrgList , 9 )
assert . Equal ( t , "org25" , apiOrgList [ 1 ] . FullName )
assert . Equal ( t , "public" , apiOrgList [ 1 ] . Visibility )
// accessing without a token will return only public orgs
req = NewRequestf ( t , "GET" , "/api/v1/orgs" )
resp = MakeRequest ( t , req , http . StatusOK )
DecodeJSON ( t , resp , & apiOrgList )
assert . Len ( t , apiOrgList , 7 )
assert . Equal ( t , "org25" , apiOrgList [ 0 ] . FullName )
assert . Equal ( t , "public" , apiOrgList [ 0 ] . Visibility )
}
func TestAPIOrgSearchEmptyTeam ( t * testing . T ) {