示例#1
0
func TestListOrgs(t *testing.T) {
	t.Parallel()

	j := Client.Get(t, "/user/orgs", 200).JSON(t)

	var found bool
	v := j.KeepFields("login")
	expect := jsons.Parse(`{"login": "******"}`).String()
	for _, e := range v.(jsons.Array) {
		if jsons.Cast(e).String() == expect {
			found = true
			break
		}
	}

	assert.True(t, found, "current user doesn't belong to go-gophers organization")
}
示例#2
0
func TestRepoList(t *testing.T) {
	t.Parallel()

	repo := createRepo(t, false)
	defer destroyRepo(t, repo)

	j := Client.Get(t, "/user/repos?visibility=public&affiliation=owner&sort=created", 200).JSON(t)

	var found bool
	v := j.KeepFields("name")
	expect := jsons.Parse(`{"name": %q}`, repo).String()
	for _, e := range v.(jsons.Array) {
		if jsons.Cast(e).String() == expect {
			found = true
			break
		}
	}

	assert.True(t, found, "created repository not found in list")
}