* fix org visibility bug * fix permission check * add integration tests * fix tests * change test user name for easier maintainance and fix test * fix test git repo name
This commit is contained in:
parent
e6cd4f3276
commit
81adf6ad86
88 changed files with 2873 additions and 22 deletions
|
@ -41,3 +41,63 @@ func TestOrgRepos(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestLimitedOrg(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
// not logged in user
|
||||
req := NewRequest(t, "GET", "/limited_org")
|
||||
MakeRequest(t, req, http.StatusNotFound)
|
||||
req = NewRequest(t, "GET", "/limited_org/public_repo_on_limited_org")
|
||||
MakeRequest(t, req, http.StatusNotFound)
|
||||
req = NewRequest(t, "GET", "/limited_org/private_repo_on_limited_org")
|
||||
MakeRequest(t, req, http.StatusNotFound)
|
||||
|
||||
// login non-org member user
|
||||
session := loginUser(t, "user2")
|
||||
req = NewRequest(t, "GET", "/limited_org")
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
req = NewRequest(t, "GET", "/limited_org/public_repo_on_limited_org")
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
req = NewRequest(t, "GET", "/limited_org/private_repo_on_limited_org")
|
||||
session.MakeRequest(t, req, http.StatusNotFound)
|
||||
|
||||
// site admin
|
||||
session = loginUser(t, "user1")
|
||||
req = NewRequest(t, "GET", "/limited_org")
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
req = NewRequest(t, "GET", "/limited_org/public_repo_on_limited_org")
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
req = NewRequest(t, "GET", "/limited_org/private_repo_on_limited_org")
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
}
|
||||
|
||||
func TestPrivateOrg(t *testing.T) {
|
||||
prepareTestEnv(t)
|
||||
|
||||
// not logged in user
|
||||
req := NewRequest(t, "GET", "/privated_org")
|
||||
MakeRequest(t, req, http.StatusNotFound)
|
||||
req = NewRequest(t, "GET", "/privated_org/public_repo_on_private_org")
|
||||
MakeRequest(t, req, http.StatusNotFound)
|
||||
req = NewRequest(t, "GET", "/privated_org/private_repo_on_private_org")
|
||||
MakeRequest(t, req, http.StatusNotFound)
|
||||
|
||||
// login non-org member user
|
||||
session := loginUser(t, "user2")
|
||||
req = NewRequest(t, "GET", "/privated_org")
|
||||
session.MakeRequest(t, req, http.StatusNotFound)
|
||||
req = NewRequest(t, "GET", "/privated_org/public_repo_on_private_org")
|
||||
session.MakeRequest(t, req, http.StatusNotFound)
|
||||
req = NewRequest(t, "GET", "/privated_org/private_repo_on_private_org")
|
||||
session.MakeRequest(t, req, http.StatusNotFound)
|
||||
|
||||
// site admin
|
||||
session = loginUser(t, "user1")
|
||||
req = NewRequest(t, "GET", "/privated_org")
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
req = NewRequest(t, "GET", "/privated_org/public_repo_on_private_org")
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
req = NewRequest(t, "GET", "/privated_org/private_repo_on_private_org")
|
||||
session.MakeRequest(t, req, http.StatusOK)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue