mirror of
https://github.com/appleboy/drone-telegram.git
synced 2026-06-04 18:23:45 +08:00
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:
+23
-17
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user