@@ -3,21 +3,22 @@ package hook
33import (
44 "bytes"
55 "errors"
6- "github.com/lucasgomide/snitch/config"
7- "github.com/lucasgomide/snitch/types"
8- "gopkg.in/jarcoal/httpmock.v1"
96 "log"
107 "os"
118 "strings"
129 "testing"
10+
11+ "github.com/lucasgomide/snitch/config"
12+ "github.com/lucasgomide/snitch/types"
13+ "gopkg.in/jarcoal/httpmock.v1"
1314)
1415
1516var (
1617 h HookFake
1718 tsuruFake TsuruFake
1819 err error
1920 configFilePath = "../testdata/config.yaml"
20- d = []types.Deploy {types. Deploy {"app" , "1234125125" , "sha1" , "user@42.com" , "v15" }}
21+ d = []types.Deploy {{"app" , "1234125125" , "sha1" , "user@42.com" , "v15" }}
2122 conf = map [interface {}]interface {}{"field_sample" : "key_value" }
2223)
2324
@@ -50,7 +51,7 @@ func (t TsuruFake) FindLastDeploy(deploy *[]types.Deploy) error {
5051}
5152
5253func TestHookExecutedSuccessfully (t * testing.T ) {
53- if err = ExecuteHook (& h , d , conf ); err != nil {
54+ if err = executeHook (& h , d , conf ); err != nil {
5455 t .Error (err )
5556 }
5657
@@ -62,7 +63,7 @@ func TestHookExecutedSuccessfully(t *testing.T) {
6263func TestReturnsErrorWhenCallHookFail (t * testing.T ) {
6364 expected := "CallHook has failed"
6465 h .Err = errors .New (expected )
65- err = ExecuteHook (& h , d , conf )
66+ err = executeHook (& h , d , conf )
6667
6768 if err == nil {
6869 t .Error ("Expected error, got nil" )
@@ -74,7 +75,7 @@ func TestReturnsErrorWhenCallHookFail(t *testing.T) {
7475
7576func TestSetFieldsWithEnvValues (t * testing.T ) {
7677 os .Setenv ("NEW_ENV" , "gotham" )
77- if err = ExecuteHook (& h , d , map [interface {}]interface {}{"field_sample" : "$NEW_ENV" }); err != nil {
78+ if err = executeHook (& h , d , map [interface {}]interface {}{"field_sample" : "$NEW_ENV" }); err != nil {
7879 t .Error (err )
7980 }
8081
0 commit comments