delete assets that failed to upload

[#121455813]

Signed-off-by: Yucheng Tu <ytu@pivotal.io>
This commit is contained in:
Evan Short
2016-06-13 17:45:11 -07:00
committed by Yucheng Tu
parent de0080906a
commit b0114ca8b4
2 changed files with 28 additions and 15 deletions

View File

@@ -69,24 +69,29 @@ var _ = Describe("Out Command", func() {
Name: github.String("unicorns.txt"),
},
{
ID: github.Int(3450798),
Name: github.String("rainbows.txt"),
ID: github.Int(3450798),
Name: github.String("rainbows.txt"),
State: github.String("new"),
},
}
existingReleases := []github.RepositoryRelease{
{
ID: github.Int(1),
Draft: github.Bool(true),
},
{
ID: github.Int(112),
TagName: github.String("some-tag-name"),
Assets: []github.ReleaseAsset{existingAssets[0]},
Draft: github.Bool(false),
},
}
BeforeEach(func() {
githubClient.ListReleasesReturns([]github.RepositoryRelease{
{
ID: github.Int(1),
Draft: github.Bool(true),
},
{
ID: github.Int(112),
TagName: github.String("some-tag-name"),
Assets: existingAssets,
Draft: github.Bool(false),
},
}, nil)
githubClient.ListReleasesReturns(existingReleases, nil)
githubClient.ListReleaseAssetsReturns(existingAssets, nil)
namePath := filepath.Join(sourcesDir, "name")
bodyPath := filepath.Join(sourcesDir, "body")
@@ -106,6 +111,9 @@ var _ = Describe("Out Command", func() {
})
It("deletes the existing assets", func() {
Ω(githubClient.ListReleaseAssetsCallCount()).Should(Equal(1))
Ω(githubClient.ListReleaseAssetsArgsForCall(0)).Should(Equal(existingReleases[1]))
Ω(githubClient.DeleteReleaseAssetCallCount()).Should(Equal(2))
Ω(githubClient.DeleteReleaseAssetArgsForCall(0)).Should(Equal(existingAssets[0]))