コード例 #1
0
func newDraftRepositoryRelease(id int, version string) github.RepositoryRelease {
	return github.RepositoryRelease{
		TagName: github.String(version),
		Draft:   github.Bool(true),
		ID:      github.Int(id),
	}
}
コード例 #2
0
		request  resource.OutRequest
		response resource.OutResponse
	)

	BeforeEach(func() {
		var err error

		githubClient = &fakes.FakeGitHub{}
		command = resource.NewOutCommand(githubClient, ioutil.Discard)

		sourcesDir, err = ioutil.TempDir("", "github-release")
		Ω(err).ShouldNot(HaveOccurred())

		githubClient.CreateReleaseStub = func(gh github.RepositoryRelease) (*github.RepositoryRelease, error) {
			createdRel := gh
			createdRel.ID = github.Int(112)
			createdRel.HTMLURL = github.String("http://google.com")
			createdRel.Name = github.String("release-name")
			createdRel.Body = github.String("*markdown*")
			return &createdRel, nil
		}

		githubClient.UpdateReleaseStub = func(gh github.RepositoryRelease) (*github.RepositoryRelease, error) {
			return &gh, nil
		}
	})

	JustBeforeEach(func() {
		var err error
		response, err = command.Run(sourcesDir, request)
		Ω(err).ShouldNot(HaveOccurred())
コード例 #3
0
		Ω(err).ShouldNot(HaveOccurred())

		destDir = filepath.Join(tmpDir, "destination")

		githubClient.DownloadReleaseAssetReturns(ioutil.NopCloser(bytes.NewBufferString("some-content")), nil)

		inRequest = resource.InRequest{}
	})

	AfterEach(func() {
		Ω(os.RemoveAll(tmpDir)).Should(Succeed())
	})

	buildRelease := func(id int, tag string) *github.RepositoryRelease {
		return &github.RepositoryRelease{
			ID:      github.Int(id),
			TagName: github.String(tag),
			HTMLURL: github.String("http://google.com"),
			Name:    github.String("release-name"),
			Body:    github.String("*markdown*"),
		}
	}

	buildAsset := func(id int, name string) github.ReleaseAsset {
		return github.ReleaseAsset{
			ID:   github.Int(id),
			Name: &name,
		}
	}

	Context("when there is a tagged release", func() {
コード例 #4
0
func newDraftWithNilTagRepositoryRelease(id int) github.RepositoryRelease {
	return github.RepositoryRelease{
		Draft: github.Bool(true),
		ID:    github.Int(id),
	}
}