Decouple 'commit' object and add commit.link (#51)

* Decouple commit out from build and add commit.link

* Fix tests for Commit decouple

* Update documentation for Commit decouple
This commit is contained in:
Rafael Bodill
2017-09-11 07:34:47 +03:00
committed by Bo-Yi Wu
parent 709c4ce6a8
commit 6f651a91d2
5 changed files with 79 additions and 49 deletions
+23 -17
View File
@@ -33,18 +33,20 @@ func TestDefaultMessageFormat(t *testing.T) {
Name: "go-hello",
Owner: "appleboy",
},
Build: Build{
Number: 101,
Status: "success",
Link: "https://github.com/appleboy/go-hello",
Commit: Commit{
Sha: "e7c4f0a63ceeb42a39ac7806f7b51f3f0d204fd2",
Author: "Bo-Yi Wu",
Branch: "master",
Message: "update travis",
Commit: "e7c4f0a63ceeb42a39ac7806f7b51f3f0d204fd2",
},
Build: Build{
Number: 101,
Status: "success",
Link: "https://github.com/appleboy/go-hello",
},
}
message := plugin.Message(plugin.Repo, plugin.Build)
message := plugin.Message(plugin.Repo, plugin.Commit, plugin.Build)
assert.Equal(t, []string{"[success] <https://github.com/appleboy/go-hello> (master)『update travis』by Bo-Yi Wu"}, message)
}
@@ -55,17 +57,19 @@ func TestSendMessage(t *testing.T) {
Name: "go-hello",
Owner: "appleboy",
},
Build: Build{
Tag: "1.0.0",
Number: 101,
Status: "success",
Link: "https://github.com/appleboy/go-hello",
Commit: Commit{
Sha: "e7c4f0a63ceeb42a39ac7806f7b51f3f0d204fd2",
Author: "Bo-Yi Wu",
Branch: "master",
Message: "update travis by drone plugin",
Commit: "e7c4f0a63ceeb42a39ac7806f7b51f3f0d204fd2",
Email: "test@gmail.com",
},
Build: Build{
Tag: "1.0.0",
Number: 101,
Status: "success",
Link: "https://github.com/appleboy/go-hello",
},
Config: Config{
Token: os.Getenv("TELEGRAM_TOKEN"),
@@ -103,14 +107,16 @@ func TestBotError(t *testing.T) {
Name: "go-hello",
Owner: "appleboy",
},
Build: Build{
Number: 101,
Status: "success",
Link: "https://github.com/appleboy/go-hello",
Commit: Commit{
Sha: "e7c4f0a63ceeb42a39ac7806f7b51f3f0d204fd2",
Author: "Bo-Yi Wu",
Branch: "master",
Message: "update travis by drone plugin",
Commit: "e7c4f0a63ceeb42a39ac7806f7b51f3f0d204fd2",
},
Build: Build{
Number: 101,
Status: "success",
Link: "https://github.com/appleboy/go-hello",
},
Config: Config{