forked from drone/go-scm
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the support for delete of the bitbucket file (drone#139)
* Add the support for delete of the bitbucket * Removed the print statements * Fix the delete file in bitbucket test
- Loading branch information
1 parent
6f375cd
commit abe308c
Showing
3 changed files
with
79 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,10 +183,36 @@ func TestContentUpdateBadCommitID(t *testing.T) { | |
} | ||
|
||
func TestContentDelete(t *testing.T) { | ||
content := new(contentService) | ||
_, err := content.Delete(context.Background(), "atlassian/atlaskit", "README", &scm.ContentParams{}) | ||
if err != scm.ErrNotSupported { | ||
t.Errorf("Expect Not Supported error") | ||
defer gock.Off() | ||
|
||
gock.New("https://api.bitbucket.org"). | ||
Post("/2.0/repositories/atlassian/atlaskit/src"). | ||
Reply(201). | ||
Type("application/json") | ||
|
||
params := &scm.ContentParams{ | ||
Message: "my commit message", | ||
Signature: scm.Signature{ | ||
Name: "Monalisa Octocat", | ||
Email: "[email protected]", | ||
}, | ||
} | ||
|
||
client := NewDefault() | ||
res, err := client.Contents.Update( | ||
context.Background(), | ||
"atlassian/atlaskit", | ||
"test/hello", | ||
params, | ||
) | ||
|
||
if err != nil { | ||
t.Error(err) | ||
return | ||
} | ||
|
||
if res.Status != 201 { | ||
t.Errorf("Unexpected Results") | ||
} | ||
} | ||
|
||
|