mirror of
https://github.com/documize/community.git
synced 2025-07-22 06:39:43 +02:00
initial commit
This commit is contained in:
commit
18933c6767
1841 changed files with 810642 additions and 0 deletions
71
vendor/github.com/google/go-github/github/users_administration_test.go
generated
vendored
Normal file
71
vendor/github.com/google/go-github/github/users_administration_test.go
generated
vendored
Normal file
|
@ -0,0 +1,71 @@
|
|||
// Copyright 2014 The go-github AUTHORS. All rights reserved.
|
||||
//
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package github
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUsersService_PromoteSiteAdmin(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/users/u/site_admin", func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "PUT")
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
})
|
||||
|
||||
_, err := client.Users.PromoteSiteAdmin("u")
|
||||
if err != nil {
|
||||
t.Errorf("Users.PromoteSiteAdmin returned error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUsersService_DemoteSiteAdmin(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/users/u/site_admin", func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "DELETE")
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
})
|
||||
|
||||
_, err := client.Users.DemoteSiteAdmin("u")
|
||||
if err != nil {
|
||||
t.Errorf("Users.DemoteSiteAdmin returned error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUsersService_Suspend(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/users/u/suspended", func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "PUT")
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
})
|
||||
|
||||
_, err := client.Users.Suspend("u")
|
||||
if err != nil {
|
||||
t.Errorf("Users.Suspend returned error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUsersService_Unsuspend(t *testing.T) {
|
||||
setup()
|
||||
defer teardown()
|
||||
|
||||
mux.HandleFunc("/users/u/suspended", func(w http.ResponseWriter, r *http.Request) {
|
||||
testMethod(t, r, "DELETE")
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
})
|
||||
|
||||
_, err := client.Users.Unsuspend("u")
|
||||
if err != nil {
|
||||
t.Errorf("Users.Unsuspend returned error: %v", err)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue