This is an automated email from the ASF dual-hosted git repository.
rawlin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git
The following commit(s) were added to refs/heads/master by this push:
new 241c537 fixes broken unit tests when change log messages were
improved (#3872)
241c537 is described below
commit 241c537284b695088a58fc4875badf29d090c776
Author: Jeremy Mitchell <[email protected]>
AuthorDate: Thu Aug 15 14:39:28 2019 -0600
fixes broken unit tests when change log messages were improved (#3872)
---
traffic_ops/traffic_ops_golang/api/shared_handlers_test.go | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/traffic_ops/traffic_ops_golang/api/shared_handlers_test.go
b/traffic_ops/traffic_ops_golang/api/shared_handlers_test.go
index f894d53..62965da 100644
--- a/traffic_ops/traffic_ops_golang/api/shared_handlers_test.go
+++ b/traffic_ops/traffic_ops_golang/api/shared_handlers_test.go
@@ -133,7 +133,8 @@ func TestCreateHandler(t *testing.T) {
createFunc := CreateHandler(typeRef)
//verifies we get the right changelog insertion
- expectedMessage := Created + " " + typeRef.GetType() + ": " +
typeRef.GetAuditName() + " keys: { id:1 }"
+ keys, _ := typeRef.GetKeys()
+ expectedMessage := strings.ToUpper(typeRef.GetType()) + ": " +
typeRef.GetAuditName() + ", ID: " + strconv.Itoa(keys["id"].(int)) + ", ACTION:
" + Created + " " + typeRef.GetType() + ", keys: { id:" +
strconv.Itoa(keys["id"].(int)) + " }"
mock.ExpectBegin()
mock.ExpectExec("INSERT").WithArgs(ApiChange, expectedMessage,
1).WillReturnResult(sqlmock.NewResult(1, 1))
mock.ExpectCommit()
@@ -218,7 +219,8 @@ func TestUpdateHandler(t *testing.T) {
updateFunc := UpdateHandler(typeRef)
//verifies we get the right changelog insertion
- expectedMessage := Updated + " " + typeRef.GetType() + ": " +
typeRef.GetAuditName() + " keys: { id:1 }"
+ keys, _ := typeRef.GetKeys()
+ expectedMessage := strings.ToUpper(typeRef.GetType()) + ": " +
typeRef.GetAuditName() + ", ID: " + strconv.Itoa(keys["id"].(int)) + ", ACTION:
" + Updated + " " + typeRef.GetType() + ", keys: { id:" +
strconv.Itoa(keys["id"].(int)) + " }"
mock.ExpectBegin()
mock.ExpectExec("INSERT").WithArgs(ApiChange, expectedMessage,
1).WillReturnResult(sqlmock.NewResult(1, 1))
mock.ExpectCommit()
@@ -263,7 +265,8 @@ func TestDeleteHandler(t *testing.T) {
deleteFunc := DeleteHandler(typeRef)
//verifies we get the right changelog insertion
- expectedMessage := Deleted + " " + typeRef.GetType() + ": " +
typeRef.GetAuditName() + " keys: { id:1 }"
+ keys, _ := typeRef.GetKeys()
+ expectedMessage := strings.ToUpper(typeRef.GetType()) + ": " +
typeRef.GetAuditName() + ", ID: " + strconv.Itoa(keys["id"].(int)) + ", ACTION:
" + Deleted + " " + typeRef.GetType() + ", keys: { id:" +
strconv.Itoa(keys["id"].(int)) + " }"
mock.ExpectBegin()
mock.ExpectExec("INSERT").WithArgs(ApiChange, expectedMessage,
1).WillReturnResult(sqlmock.NewResult(1, 1))
mock.ExpectCommit()