本文整理汇总了Golang中github.com/remind101/deploy/Godeps/_workspace/src/github.com/bmizerany/assert.T函数的典型用法代码示例。如果您正苦于以下问题:Golang T函数的具体用法?Golang T怎么用?Golang T使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了T函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestRepositoresService_CreateFork
func TestRepositoresService_CreateFork(t *testing.T) {
setup()
defer tearDown()
mux.HandleFunc("/repos/jingweno/octokat/forks", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testBody(t, r, "{\"organization\":\"github\"}\n")
respondWithJSON(w, loadFixture("create_repository.json"))
})
url, err := ForksURL.Expand(M{"owner": "jingweno", "repo": "octokat"})
assert.Equal(t, nil, err)
repo, result := client.Repositories(url).Create(M{"organization": "github"})
assert.T(t, !result.HasError())
assert.Equal(t, 1296269, repo.ID)
assert.Equal(t, "Hello-World", repo.Name)
assert.Equal(t, "octocat/Hello-World", repo.FullName)
assert.Equal(t, "This is your first repo", repo.Description)
assert.T(t, !repo.Private)
assert.T(t, repo.Fork)
assert.Equal(t, "https://api.github.com/repos/octocat/Hello-World", repo.URL)
assert.Equal(t, "https://github.com/octocat/Hello-World", repo.HTMLURL)
assert.Equal(t, "https://github.com/octocat/Hello-World.git", repo.CloneURL)
assert.Equal(t, "git://github.com/octocat/Hello-World.git", repo.GitURL)
assert.Equal(t, "[email protected]:octocat/Hello-World.git", repo.SSHURL)
assert.Equal(t, "master", repo.MasterBranch)
}
开发者ID:ZBNA,项目名称:deploy,代码行数:29,代码来源:repositories_test.go
示例2: TestUsersService_All
func TestUsersService_All(t *testing.T) {
setup()
defer tearDown()
mux.HandleFunc("/users", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
rr := regexp.MustCompile(`users\?since=\d+`)
assert.Tf(t, rr.MatchString(r.URL.String()), "Regexp should match users?since=\\d+")
header := w.Header()
link := fmt.Sprintf(`<%s>; rel="next", <%s>; rel="first"`, testURLOf("users?since=135"), testURLOf("users{?since}"))
header.Set("Link", link)
respondWithJSON(w, loadFixture("users.json"))
})
url, err := UserURL.Expand(M{"since": 1})
assert.Equal(t, nil, err)
q := url.Query()
q.Set("since", "1")
url.RawQuery = q.Encode()
allUsers, result := client.Users(url).All()
assert.T(t, !result.HasError())
assert.Equal(t, 1, len(allUsers))
assert.Equal(t, testURLStringOf("users?since=135"), string(*result.NextPage))
nextPageURL, err := result.NextPage.Expand(nil)
assert.Equal(t, nil, err)
allUsers, result = client.Users(nextPageURL).All()
assert.T(t, !result.HasError())
assert.Equal(t, 1, len(allUsers))
}
开发者ID:ZBNA,项目名称:deploy,代码行数:35,代码来源:users_test.go
示例3: TestAuthorizationsService_Create
func TestAuthorizationsService_Create(t *testing.T) {
setup()
defer tearDown()
params := AuthorizationParams{Scopes: []string{"public_repo"}}
mux.HandleFunc("/authorizations", func(w http.ResponseWriter, r *http.Request) {
var authParams AuthorizationParams
json.NewDecoder(r.Body).Decode(&authParams)
assert.T(t, reflect.DeepEqual(authParams, params))
testMethod(t, r, "POST")
respondWithJSON(w, loadFixture("create_authorization.json"))
})
url, err := AuthorizationsURL.Expand(nil)
assert.Equal(t, nil, err)
auth, _ := client.Authorizations(url).Create(params)
assert.Equal(t, 3844190, auth.ID)
assert.Equal(t, "https://api.github.com/authorizations/3844190", auth.URL)
assert.Equal(t, "123", auth.Token)
assert.Equal(t, "", auth.Note)
assert.Equal(t, "", auth.NoteURL)
assert.Equal(t, "2013-09-28 18:44:39 +0000 UTC", auth.CreatedAt.String())
assert.Equal(t, "2013-09-28 18:44:39 +0000 UTC", auth.UpdatedAt.String())
app := App{ClientID: "00000000000000000000", URL: "http://developer.github.com/v3/oauth/#oauth-authorizations-api", Name: "GitHub API"}
assert.Equal(t, app, auth.App)
assert.Equal(t, 1, len(auth.Scopes))
scopes := []string{"public_repo"}
assert.T(t, reflect.DeepEqual(auth.Scopes, scopes))
}
开发者ID:ZBNA,项目名称:deploy,代码行数:35,代码来源:authorizations_test.go
示例4: TestAuthorizationsService_All
func TestAuthorizationsService_All(t *testing.T) {
setup()
defer tearDown()
mux.HandleFunc("/authorizations", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
respondWithJSON(w, loadFixture("authorizations.json"))
})
url, err := AuthorizationsURL.Expand(nil)
assert.Equal(t, nil, err)
auths, result := client.Authorizations(url).All()
assert.T(t, !result.HasError())
firstAuth := auths[0]
assert.Equal(t, 1, firstAuth.ID)
assert.Equal(t, "https://api.github.com/authorizations/1", firstAuth.URL)
assert.Equal(t, "456", firstAuth.Token)
assert.Equal(t, "", firstAuth.Note)
assert.Equal(t, "", firstAuth.NoteURL)
assert.Equal(t, "2012-11-16 01:05:51 +0000 UTC", firstAuth.CreatedAt.String())
assert.Equal(t, "2013-08-21 03:29:51 +0000 UTC", firstAuth.UpdatedAt.String())
app := App{ClientID: "123", URL: "http://localhost:8080", Name: "Test"}
assert.Equal(t, app, firstAuth.App)
assert.Equal(t, 2, len(firstAuth.Scopes))
scopes := []string{"repo", "user"}
assert.T(t, reflect.DeepEqual(firstAuth.Scopes, scopes))
}
开发者ID:ZBNA,项目名称:deploy,代码行数:31,代码来源:authorizations_test.go
示例5: TestNewResult_Pageable
func TestNewResult_Pageable(t *testing.T) {
resp := &Response{MediaHeader: &mediaheader.MediaHeader{Relations: hypermedia.Relations{"next": hypermedia.Hyperlink("/path")}}}
result := newResult(resp, nil)
assert.Equal(t, "/path", string(*result.NextPage))
assert.T(t, result.PrevPage == nil)
assert.T(t, result.LastPage == nil)
assert.T(t, result.FirstPage == nil)
}
开发者ID:ZBNA,项目名称:deploy,代码行数:9,代码来源:result_test.go
示例6: TestUploadsService_UploadAsset
func TestUploadsService_UploadAsset(t *testing.T) {
setup()
defer tearDown()
file, err := ioutil.TempFile("", "octokit-test-upload-")
assert.Equal(t, nil, err)
file.WriteString("this is a test")
fi, err := file.Stat()
assert.Equal(t, nil, err)
file.Close()
mux.HandleFunc("/repos/octokit/Hello-World/releases/123/assets", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testHeader(t, r, "Content-Type", "text/plain")
assert.Equal(t, fi.Size(), r.ContentLength)
respondWithStatus(w, 201)
})
link := Hyperlink("/repos/octokit/Hello-World/releases/123/assets{?name}")
url, err := link.Expand(M{"name": fi.Name()})
assert.Equal(t, nil, err)
open, _ := os.Open(file.Name())
result := client.Uploads(url).UploadAsset(open, "text/plain", fi.Size())
fmt.Println(result)
assert.T(t, !result.HasError())
assert.Equal(t, 201, result.Response.StatusCode)
}
开发者ID:ZBNA,项目名称:deploy,代码行数:30,代码来源:uploads_test.go
示例7: TestGitTreesService_One_Recursive
func TestGitTreesService_One_Recursive(t *testing.T) {
setup()
defer tearDown()
mux.HandleFunc("/repos/pengwynn/flint/git/trees/master", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
respondWithJSON(w, loadFixture("tree_recursive.json"))
})
url, err := GitTreesURL.Expand(M{
"owner": "pengwynn",
"repo": "flint",
"sha": "master",
"recursive": "1",
})
assert.Equal(t, nil, err)
tree, result := client.GitTrees(url).One()
assert.T(t, !result.HasError())
assert.Equal(t, "9c1337e761bbd517f3cc1b5acb9373b17f4810e8", tree.Sha)
assert.Equal(t, "https://api.github.com/repos/pengwynn/flint/git/trees/9c1337e761bbd517f3cc1b5acb9373b17f4810e8", tree.URL)
entries := tree.Tree
assert.Equal(t, 15, len(entries))
}
开发者ID:ZBNA,项目名称:deploy,代码行数:25,代码来源:git_trees_test.go
示例8: TestGitDir
func TestGitDir(t *testing.T) {
repo := fixtures.SetupTestRepo()
defer repo.TearDown()
gitDir, _ := Dir()
assert.T(t, strings.Contains(gitDir, ".git"))
}
开发者ID:ZBNA,项目名称:deploy,代码行数:7,代码来源:git_test.go
示例9: TestEditor_openAndEdit_deleteFileWhenOpeningEditorFails
func TestEditor_openAndEdit_deleteFileWhenOpeningEditorFails(t *testing.T) {
tempFile, _ := ioutil.TempFile("", "editor-test")
tempFile.Close()
ioutil.WriteFile(tempFile.Name(), []byte("hello"), 0644)
editor := Editor{
Program: "memory",
File: tempFile.Name(),
Topic: "test",
openEditor: func(program string, file string) error {
assert.Equal(t, "memory", program)
assert.Equal(t, tempFile.Name(), file)
return fmt.Errorf("error")
},
}
_, err := os.Stat(tempFile.Name())
assert.Equal(t, nil, err)
_, err = editor.openAndEdit()
assert.Equal(t, "error using text editor for test message", fmt.Sprintf("%s", err))
// file is removed if there's error
_, err = os.Stat(tempFile.Name())
assert.T(t, os.IsNotExist(err))
}
开发者ID:ZBNA,项目名称:deploy,代码行数:26,代码来源:editor_test.go
示例10: TestPullRequestService_Post
func TestPullRequestService_Post(t *testing.T) {
setup()
defer tearDown()
mux.HandleFunc("/repos/octokit/go-octokit/pulls", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testBody(t, r,
"{\"base\":\"base\",\"head\":\"head\",\"title\":\"title\",\"body\":\"body\"}\n")
respondWithJSON(w, loadFixture("pull_request.json"))
})
url, err := PullRequestsURL.Expand(M{"owner": "octokit", "repo": "go-octokit"})
assert.Equal(t, nil, err)
params := PullRequestParams{
Base: "base",
Head: "head",
Title: "title",
Body: "body",
}
pr, result := client.PullRequests(url).Create(params)
assert.T(t, !result.HasError())
assert.Equal(t, 1, pr.ChangedFiles)
assert.Equal(t, 1, pr.Deletions)
assert.Equal(t, 1, pr.Additions)
assert.Equal(t, "aafce5dfc44270f35270b24677abbb859b20addf", pr.MergeCommitSha)
assert.Equal(t, "2013-06-09 00:53:38 +0000 UTC", pr.MergedAt.String())
assert.Equal(t, "2013-06-09 00:53:38 +0000 UTC", pr.ClosedAt.String())
assert.Equal(t, "2013-06-19 00:35:24 +0000 UTC", pr.UpdatedAt.String())
assert.Equal(t, "2013-06-09 00:52:12 +0000 UTC", pr.CreatedAt.String())
assert.Equal(t, "typo", pr.Body)
assert.Equal(t, "Update README.md", pr.Title)
assert.Equal(t, "https://api.github.com/repos/jingweno/octokat/pulls/1", pr.URL)
assert.Equal(t, 6206442, pr.ID)
assert.Equal(t, "https://github.com/jingweno/octokat/pull/1", pr.HTMLURL)
assert.Equal(t, "https://github.com/jingweno/octokat/pull/1.diff", pr.DiffURL)
assert.Equal(t, "https://github.com/jingweno/octokat/pull/1.patch", pr.PatchURL)
assert.Equal(t, "https://github.com/jingweno/octokat/pull/1", pr.IssueURL)
assert.Equal(t, 1, pr.Number)
assert.Equal(t, "closed", pr.State)
assert.T(t, nil == pr.Assignee)
assert.Equal(t, "https://github.com/jingweno/octokat/pull/1/commits", pr.CommitsURL)
assert.Equal(t, "https://github.com/jingweno/octokat/pull/1/comments", pr.ReviewCommentsURL)
assert.Equal(t, "/repos/jingweno/octokat/pulls/comments/{number}", pr.ReviewCommentURL)
assert.Equal(t, "https://api.github.com/repos/jingweno/octokat/issues/1/comments", pr.CommentsURL)
}
开发者ID:ZBNA,项目名称:deploy,代码行数:47,代码来源:pull_requests_test.go
示例11: TestRepositoresService_Create
func TestRepositoresService_Create(t *testing.T) {
setup()
defer tearDown()
params := Repository{}
params.Name = "Hello-World"
params.Description = "This is your first repo"
params.Homepage = "https://github.com"
params.Private = false
params.HasIssues = true
params.HasWiki = true
params.HasDownloads = true
mux.HandleFunc("/user/repos", func(w http.ResponseWriter, r *http.Request) {
var repoParams Repository
json.NewDecoder(r.Body).Decode(&repoParams)
assert.Equal(t, params.Name, repoParams.Name)
assert.Equal(t, params.Description, repoParams.Description)
assert.Equal(t, params.Homepage, repoParams.Homepage)
assert.Equal(t, params.Private, repoParams.Private)
assert.Equal(t, params.HasIssues, repoParams.HasIssues)
assert.Equal(t, params.HasWiki, repoParams.HasWiki)
assert.Equal(t, params.HasDownloads, repoParams.HasDownloads)
testMethod(t, r, "POST")
respondWithJSON(w, loadFixture("create_repository.json"))
})
url, err := UserRepositoriesURL.Expand(nil)
assert.Equal(t, nil, err)
repo, result := client.Repositories(url).Create(params)
assert.T(t, !result.HasError())
assert.Equal(t, 1296269, repo.ID)
assert.Equal(t, "Hello-World", repo.Name)
assert.Equal(t, "octocat/Hello-World", repo.FullName)
assert.Equal(t, "This is your first repo", repo.Description)
assert.T(t, !repo.Private)
assert.T(t, repo.Fork)
assert.Equal(t, "https://api.github.com/repos/octocat/Hello-World", repo.URL)
assert.Equal(t, "https://github.com/octocat/Hello-World", repo.HTMLURL)
assert.Equal(t, "https://github.com/octocat/Hello-World.git", repo.CloneURL)
assert.Equal(t, "git://github.com/octocat/Hello-World.git", repo.GitURL)
assert.Equal(t, "[email protected]:octocat/Hello-World.git", repo.SSHURL)
assert.Equal(t, "master", repo.MasterBranch)
}
开发者ID:ZBNA,项目名称:deploy,代码行数:47,代码来源:repositories_test.go
示例12: TestReleasesService_All
func TestReleasesService_All(t *testing.T) {
setup()
defer tearDown()
mux.HandleFunc("/repos/jingweno/gh/releases", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
respondWithJSON(w, loadFixture("releases.json"))
})
url, err := ReleasesURL.Expand(M{"owner": "jingweno", "repo": "gh"})
assert.Equal(t, nil, err)
releases, result := client.Releases(url).All()
assert.T(t, !result.HasError())
assert.Equal(t, 1, len(releases))
firstRelease := releases[0]
assert.Equal(t, 50013, firstRelease.ID)
assert.Equal(t, "v0.23.0", firstRelease.TagName)
assert.Equal(t, "master", firstRelease.TargetCommitish)
assert.Equal(t, "v0.23.0", firstRelease.Name)
assert.T(t, !firstRelease.Draft)
assert.T(t, !firstRelease.Prerelease)
assert.Equal(t, "* Windows works!: https://github.com/jingweno/gh/commit/6cb80cb09fd9f624a64d85438157955751a9ac70", firstRelease.Body)
assert.Equal(t, "https://api.github.com/repos/jingweno/gh/releases/50013", firstRelease.URL)
assert.Equal(t, "https://api.github.com/repos/jingweno/gh/releases/50013/assets", firstRelease.AssetsURL)
assert.Equal(t, "https://uploads.github.com/repos/jingweno/gh/releases/50013/assets{?name}", string(firstRelease.UploadURL))
assert.Equal(t, "https://github.com/jingweno/gh/releases/v0.23.0", firstRelease.HTMLURL)
assert.Equal(t, "2013-09-23 00:59:10 +0000 UTC", firstRelease.CreatedAt.String())
assert.Equal(t, "2013-09-23 01:07:56 +0000 UTC", firstRelease.PublishedAt.String())
firstReleaseAssets := firstRelease.Assets
assert.Equal(t, 8, len(firstReleaseAssets))
firstAsset := firstReleaseAssets[0]
assert.Equal(t, 20428, firstAsset.ID)
assert.Equal(t, "gh_0.23.0-snapshot_amd64.deb", firstAsset.Name)
assert.Equal(t, "gh_0.23.0-snapshot_amd64.deb", firstAsset.Label)
assert.Equal(t, "application/x-deb", firstAsset.ContentType)
assert.Equal(t, "uploaded", firstAsset.State)
assert.Equal(t, 1562984, firstAsset.Size)
assert.Equal(t, 0, firstAsset.DownloadCount)
assert.Equal(t, "https://api.github.com/repos/jingweno/gh/releases/assets/20428", firstAsset.URL)
assert.Equal(t, "2013-09-23 01:05:20 +0000 UTC", firstAsset.CreatedAt.String())
assert.Equal(t, "2013-09-23 01:07:56 +0000 UTC", firstAsset.UpdatedAt.String())
}
开发者ID:ZBNA,项目名称:deploy,代码行数:46,代码来源:releases_test.go
示例13: TestRepositoresService_One
func TestRepositoresService_One(t *testing.T) {
setup()
defer tearDown()
mux.HandleFunc("/repos/jingweno/octokat", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
respondWithJSON(w, loadFixture("repository.json"))
})
url, err := RepositoryURL.Expand(M{"owner": "jingweno", "repo": "octokat"})
assert.Equal(t, nil, err)
repo, result := client.Repositories(url).One()
assert.T(t, !result.HasError())
assert.Equal(t, 10575811, repo.ID)
assert.Equal(t, "octokat", repo.Name)
assert.Equal(t, "jingweno/octokat", repo.FullName)
assert.T(t, !repo.Private)
assert.T(t, !repo.Fork)
assert.Equal(t, "https://api.github.com/repos/jingweno/octokat", repo.URL)
assert.Equal(t, "https://github.com/jingweno/octokat", repo.HTMLURL)
assert.Equal(t, "https://github.com/jingweno/octokat.git", repo.CloneURL)
assert.Equal(t, "git://github.com/jingweno/octokat.git", repo.GitURL)
assert.Equal(t, "[email protected]:jingweno/octokat.git", repo.SSHURL)
assert.Equal(t, "master", repo.MasterBranch)
assert.T(t, !repo.Permissions.Admin)
assert.T(t, !repo.Permissions.Push)
assert.T(t, repo.Permissions.Pull)
}
开发者ID:ZBNA,项目名称:deploy,代码行数:30,代码来源:repositories_test.go
示例14: TestCommitsService_Patch
func TestCommitsService_Patch(t *testing.T) {
setup()
defer tearDown()
mux.HandleFunc("/repos/octokit/go-octokit/commits/b6d21008bf7553a29ad77ee0a8bb3b66e6f11aa2", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", patchMediaType)
respondWithJSON(w, loadFixture("commit.patch"))
})
url, err := CommitsURL.Expand(M{
"owner": "octokit",
"repo": "go-octokit",
"sha": "b6d21008bf7553a29ad77ee0a8bb3b66e6f11aa2",
})
assert.Equal(t, nil, err)
patch, result := client.Commits(url).Patch()
assert.T(t, !result.HasError())
content, err := ioutil.ReadAll(patch)
assert.Equal(t, nil, err)
assert.T(t, len(content) > 0)
}
开发者ID:ZBNA,项目名称:deploy,代码行数:23,代码来源:commits_test.go
示例15: TestRootService_One
func TestRootService_One(t *testing.T) {
setup()
defer tearDown()
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
respondWithJSON(w, loadFixture("root.json"))
})
url, err := RootURL.Expand(nil)
assert.Equal(t, nil, err)
root, result := client.Root(url).One()
assert.T(t, !result.HasError())
assert.Equal(t, "https://api.github.com/users/{user}", string(root.UserURL))
}
开发者ID:ZBNA,项目名称:deploy,代码行数:16,代码来源:root_test.go
示例16: TestIssuesService_One
func TestIssuesService_One(t *testing.T) {
setup()
defer tearDown()
mux.HandleFunc("/repos/octocat/Hello-World/issues/1347", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
respondWithJSON(w, loadFixture("issue.json"))
})
url, err := RepoIssuesURL.Expand(M{"owner": "octocat", "repo": "Hello-World", "number": 1347})
assert.Equal(t, nil, err)
issue, result := client.Issues(url).One()
assert.T(t, !result.HasError())
validateIssue(t, *issue)
}
开发者ID:ZBNA,项目名称:deploy,代码行数:17,代码来源:issues_test.go
示例17: TestRootEmojisService_All
func TestRootEmojisService_All(t *testing.T) {
setup()
defer tearDown()
mux.HandleFunc("/emojis", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
respondWithJSON(w, loadFixture("emojis.json"))
})
url, err := EmojisURL.Expand(nil)
assert.Equal(t, nil, err)
emojis, result := client.Emojis(url).All()
assert.T(t, !result.HasError())
var penguin = "https://github.global.ssl.fastly.net/images/icons/emoji/penguin.png?v5"
var metal = "https://github.global.ssl.fastly.net/images/icons/emoji/metal.png?v5"
assert.Equal(t, penguin, emojis["penguin"])
assert.Equal(t, metal, emojis["metal"])
}
开发者ID:ZBNA,项目名称:deploy,代码行数:19,代码来源:emojis_test.go
示例18: TestPullRequestService_Patch
func TestPullRequestService_Patch(t *testing.T) {
setup()
defer tearDown()
mux.HandleFunc("/repos/octokit/go-octokit/pulls/1", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testHeader(t, r, "Accept", patchMediaType)
respondWith(w, "patches galore")
})
url, err := PullRequestsURL.Expand(M{"owner": "octokit", "repo": "go-octokit", "number": 1})
assert.Equal(t, nil, err)
patch, result := client.PullRequests(url).Patch()
assert.T(t, !result.HasError())
content, err := ioutil.ReadAll(patch)
assert.Equal(t, nil, err)
assert.Equal(t, "patches galore", string(content))
}
开发者ID:ZBNA,项目名称:deploy,代码行数:20,代码来源:pull_requests_test.go
示例19: TestUsersService_GetUser
func TestUsersService_GetUser(t *testing.T) {
setup()
defer tearDown()
mux.HandleFunc("/users/jingweno", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
respondWithJSON(w, loadFixture("user.json"))
})
url, err := UserURL.Expand(M{"user": "jingweno"})
assert.Equal(t, nil, err)
user, result := client.Users(url).One()
assert.T(t, !result.HasError())
assert.Equal(t, 169064, user.ID)
assert.Equal(t, "jingweno", user.Login)
assert.Equal(t, "[email protected]", user.Email)
assert.Equal(t, "User", user.Type)
assert.Equal(t, "https://api.github.com/users/jingweno/repos", string(user.ReposURL))
}
开发者ID:ZBNA,项目名称:deploy,代码行数:20,代码来源:users_test.go
示例20: TestPullRequestService_All
func TestPullRequestService_All(t *testing.T) {
setup()
defer tearDown()
mux.HandleFunc("/repos/rails/rails/pulls", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
header := w.Header()
link := fmt.Sprintf(`<%s>; rel="next", <%s>; rel="last"`, testURLOf("repositories/8514/pulls?page=2"), testURLOf("repositories/8514/pulls?page=14"))
header.Set("Link", link)
respondWithJSON(w, loadFixture("pull_requests.json"))
})
url, err := PullRequestsURL.Expand(M{"owner": "rails", "repo": "rails"})
assert.Equal(t, nil, err)
prs, result := client.PullRequests(url).All()
assert.T(t, !result.HasError())
assert.Equal(t, 30, len(prs))
assert.Equal(t, testURLStringOf("repositories/8514/pulls?page=2"), string(*result.NextPage))
assert.Equal(t, testURLStringOf("repositories/8514/pulls?page=14"), string(*result.LastPage))
}
开发者ID:ZBNA,项目名称:deploy,代码行数:21,代码来源:pull_requests_test.go
注:本文中的github.com/remind101/deploy/Godeps/_workspace/src/github.com/bmizerany/assert.T函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论