mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
fixes on integration tests
This commit is contained in:
committed by
Dan Christian Bogos
parent
dd56a471e7
commit
c842623f4a
@@ -79,8 +79,8 @@
|
||||
{"tag": "Account", "path": "*exp.Account", "type": "*variable", "value": "~*req.Account"},
|
||||
{"tag": "Subject", "path": "*exp.Subject", "type": "*variable", "value": "~*req.Subject"},
|
||||
{"tag": "Destination", "path": "*exp.Destination", "type": "*variable", "value": "~*req.Destination"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring}"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring:UTC:2006-01-02T15:04:05Z}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring:UTC:2006-01-02T15:04:05Z}"},
|
||||
{"tag": "Usage", "path": "*exp.Usage", "type": "*variable", "value": "~*req.Usage{*duration_seconds}"},
|
||||
{"tag": "Cost", "path": "*exp.Cost", "type": "*variable", "value": "~*req.Cost{*round:4}"},
|
||||
],
|
||||
@@ -105,8 +105,8 @@
|
||||
{"tag": "Account", "path": "*exp.Account", "type": "*variable", "value": "~*req.Account"},
|
||||
{"tag": "Subject", "path": "*exp.Subject", "type": "*variable", "value": "~*req.Subject"},
|
||||
{"tag": "Destination", "path": "*exp.Destination", "type": "*variable", "value": "~*req.Destination"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring}"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring:UTC:2006-01-02T15:04:05Z}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring:UTC:2006-01-02T15:04:05Z}"},
|
||||
{"tag": "Usage", "path": "*exp.Usage", "type": "*variable", "value": "~*req.Usage{*duration_seconds}"},
|
||||
{"tag": "Cost", "path": "*exp.Cost", "type": "*variable", "value": "~*req.Cost{*round:4}"},
|
||||
],
|
||||
@@ -131,8 +131,8 @@
|
||||
{"tag": "Account", "path": "*exp.Account", "type": "*variable", "value": "~*req.Account"},
|
||||
{"tag": "Subject", "path": "*exp.Subject", "type": "*variable", "value": "~*req.Subject"},
|
||||
{"tag": "Destination", "path": "*exp.Destination", "type": "*variable", "value": "~*req.Destination"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring}"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring:UTC:2006-01-02T15:04:05Z}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring:UTC:2006-01-02T15:04:05Z}"},
|
||||
{"tag": "Usage", "path": "*exp.Usage", "type": "*variable", "value": "~*req.Usage{*duration_seconds}"},
|
||||
{"tag": "Cost", "path": "*exp.Cost", "type": "*variable", "value": "~*req.Cost{*round:4}"},
|
||||
],
|
||||
|
||||
@@ -84,8 +84,8 @@
|
||||
{"tag": "Account", "path": "*exp.Account", "type": "*variable", "value": "~*req.Account"},
|
||||
{"tag": "Subject", "path": "*exp.Subject", "type": "*variable", "value": "~*req.Subject"},
|
||||
{"tag": "Destination", "path": "*exp.Destination", "type": "*variable", "value": "~*req.Destination"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring}"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring:UTC:2006-01-02T15:04:05Z}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring:UTC:2006-01-02T15:04:05Z}"},
|
||||
{"tag": "Usage", "path": "*exp.Usage", "type": "*variable", "value": "~*req.Usage{*duration_seconds}"},
|
||||
{"tag": "Cost", "path": "*exp.Cost", "type": "*variable", "value": "~*req.Cost{*round:4}"},
|
||||
],
|
||||
@@ -110,8 +110,8 @@
|
||||
{"tag": "Account", "path": "*exp.Account", "type": "*variable", "value": "~*req.Account"},
|
||||
{"tag": "Subject", "path": "*exp.Subject", "type": "*variable", "value": "~*req.Subject"},
|
||||
{"tag": "Destination", "path": "*exp.Destination", "type": "*variable", "value": "~*req.Destination"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring}"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring:UTC:2006-01-02T15:04:05Z}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring:UTC:2006-01-02T15:04:05Z}"},
|
||||
{"tag": "Usage", "path": "*exp.Usage", "type": "*variable", "value": "~*req.Usage{*duration_seconds}"},
|
||||
{"tag": "Cost", "path": "*exp.Cost", "type": "*variable", "value": "~*req.Cost{*round:4}"},
|
||||
],
|
||||
@@ -136,8 +136,8 @@
|
||||
{"tag": "Account", "path": "*exp.Account", "type": "*variable", "value": "~*req.Account"},
|
||||
{"tag": "Subject", "path": "*exp.Subject", "type": "*variable", "value": "~*req.Subject"},
|
||||
{"tag": "Destination", "path": "*exp.Destination", "type": "*variable", "value": "~*req.Destination"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring}"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring:UTC:2006-01-02T15:04:05Z}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring:UTC:2006-01-02T15:04:05Z}"},
|
||||
{"tag": "Usage", "path": "*exp.Usage", "type": "*variable", "value": "~*req.Usage{*duration_seconds}"},
|
||||
{"tag": "Cost", "path": "*exp.Cost", "type": "*variable", "value": "~*req.Cost{*round:4}"},
|
||||
],
|
||||
|
||||
@@ -81,8 +81,8 @@
|
||||
{"tag": "Account", "path": "*exp.Account", "type": "*variable", "value": "~*req.Account"},
|
||||
{"tag": "Subject", "path": "*exp.Subject", "type": "*variable", "value": "~*req.Subject"},
|
||||
{"tag": "Destination", "path": "*exp.Destination", "type": "*variable", "value": "~*req.Destination"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring::2006-01-02T15:04:05Z}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring::2006-01-02T15:04:05Z}"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring:UTC:2006-01-02T15:04:05Z}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring:UTC:2006-01-02T15:04:05Z}"},
|
||||
{"tag": "Usage", "path": "*exp.Usage", "type": "*variable", "value": "~*req.Usage{*duration_seconds}"},
|
||||
{"tag": "Cost", "path": "*exp.Cost", "type": "*variable", "value": "~*req.Cost{*round:4}"},
|
||||
],
|
||||
@@ -107,8 +107,8 @@
|
||||
{"tag": "Account", "path": "*exp.Account", "type": "*variable", "value": "~*req.Account"},
|
||||
{"tag": "Subject", "path": "*exp.Subject", "type": "*variable", "value": "~*req.Subject"},
|
||||
{"tag": "Destination", "path": "*exp.Destination", "type": "*variable", "value": "~*req.Destination"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring::2006-01-02T15:04:05Z}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring::2006-01-02T15:04:05Z}"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring:UTC:2006-01-02T15:04:05Z}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring:UTC:2006-01-02T15:04:05Z}"},
|
||||
{"tag": "Usage", "path": "*exp.Usage", "type": "*variable", "value": "~*req.Usage{*duration_seconds}"},
|
||||
{"tag": "Cost", "path": "*exp.Cost", "type": "*variable", "value": "~*req.Cost{*round:4}"},
|
||||
],
|
||||
@@ -133,8 +133,8 @@
|
||||
{"tag": "Account", "path": "*exp.Account", "type": "*variable", "value": "~*req.Account"},
|
||||
{"tag": "Subject", "path": "*exp.Subject", "type": "*variable", "value": "~*req.Subject"},
|
||||
{"tag": "Destination", "path": "*exp.Destination", "type": "*variable", "value": "~*req.Destination"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring::2006-01-02T15:04:05Z}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring::2006-01-02T15:04:05Z}"},
|
||||
{"tag": "SetupTime", "path": "*exp.SetupTime", "type": "*variable", "value": "~*req.SetupTime{*timestring:UTC:2006-01-02T15:04:05Z}" },
|
||||
{"tag": "AnswerTime", "path": "*exp.AnswerTime", "type": "*variable", "value": "~*req.AnswerTime{*timestring:UTC:2006-01-02T15:04:05Z}"},
|
||||
{"tag": "Usage", "path": "*exp.Usage", "type": "*variable", "value": "~*req.Usage{*duration_seconds}"},
|
||||
{"tag": "Cost", "path": "*exp.Cost", "type": "*variable", "value": "~*req.Cost{*round:4}"},
|
||||
],
|
||||
|
||||
@@ -178,11 +178,19 @@ func testPosterITAMQP(t *testing.T) {
|
||||
t.Fatalf("Expected 1 event received: %d events", len(ev.Events))
|
||||
}
|
||||
body := ev.Events[0].([]byte)
|
||||
var acc map[string]any
|
||||
if err := json.Unmarshal(body, &acc); err != nil {
|
||||
var exportEv map[string]any
|
||||
if err := json.Unmarshal(body, &exportEv); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if acc[utils.AccountField] != utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account) {
|
||||
accJson, ok := exportEv["Account"].(string)
|
||||
if !ok {
|
||||
t.Fatal("Expected Account field to be string")
|
||||
}
|
||||
var acc map[string]any
|
||||
if err := json.Unmarshal([]byte(accJson), &acc); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if acc["ID"].(string) != utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account) {
|
||||
t.Errorf("Expected %q ,received %q", utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account), acc[utils.AccountField])
|
||||
}
|
||||
}
|
||||
@@ -216,11 +224,19 @@ func testPosterITAMQPv1(t *testing.T) {
|
||||
t.Fatalf("Expected 1 event received: %d events", len(ev.Events))
|
||||
}
|
||||
body := ev.Events[0].([]byte)
|
||||
var acc map[string]any
|
||||
if err := json.Unmarshal(body, &acc); err != nil {
|
||||
var exportEv map[string]any
|
||||
if err := json.Unmarshal(body, &exportEv); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if acc[utils.AccountField] != utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account) {
|
||||
accJson, ok := exportEv["Account"].(string)
|
||||
if !ok {
|
||||
t.Fatal("Expected Account field to be string")
|
||||
}
|
||||
var acc map[string]any
|
||||
if err := json.Unmarshal([]byte(accJson), &acc); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if acc["ID"].(string) != utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account) {
|
||||
t.Errorf("Expected %q ,received %q", utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account), acc[utils.AccountField])
|
||||
}
|
||||
}
|
||||
@@ -254,11 +270,19 @@ func testPosterITSQS(t *testing.T) {
|
||||
t.Fatalf("Expected 1 event received: %d events", len(ev.Events))
|
||||
}
|
||||
body := ev.Events[0].([]byte)
|
||||
var acc map[string]any
|
||||
if err := json.Unmarshal(body, &acc); err != nil {
|
||||
var exportEv map[string]any
|
||||
if err := json.Unmarshal(body, &exportEv); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if acc[utils.AccountField] != utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account) {
|
||||
accJson, ok := exportEv["Account"].(string)
|
||||
if !ok {
|
||||
t.Fatal("Expected Account field to be string")
|
||||
}
|
||||
var acc map[string]any
|
||||
if err := json.Unmarshal([]byte(accJson), &acc); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if acc["ID"].(string) != utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account) {
|
||||
t.Errorf("Expected %q ,received %q", utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account), acc[utils.AccountField])
|
||||
}
|
||||
}
|
||||
@@ -292,11 +316,19 @@ func testPosterITS3(t *testing.T) {
|
||||
t.Fatalf("Expected 1 event received: %d events", len(ev.Events))
|
||||
}
|
||||
body := ev.Events[0].([]byte)
|
||||
var acc map[string]any
|
||||
if err := json.Unmarshal(body, &acc); err != nil {
|
||||
var exportEv map[string]any
|
||||
if err := json.Unmarshal(body, &exportEv); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if acc[utils.AccountField] != utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account) {
|
||||
accJson, ok := exportEv["Account"].(string)
|
||||
if !ok {
|
||||
t.Fatal("Expected Account field to be string")
|
||||
}
|
||||
var acc map[string]any
|
||||
if err := json.Unmarshal([]byte(accJson), &acc); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if acc["ID"].(string) != utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account) {
|
||||
t.Errorf("Expected %q ,received %q", utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account), acc[utils.AccountField])
|
||||
}
|
||||
}
|
||||
@@ -330,11 +362,19 @@ func testPosterITKafka(t *testing.T) {
|
||||
t.Fatalf("Expected 1 event received: %d events", len(ev.Events))
|
||||
}
|
||||
body := ev.Events[0].([]byte)
|
||||
var acc map[string]any
|
||||
if err := json.Unmarshal(body, &acc); err != nil {
|
||||
var exportEv map[string]any
|
||||
if err := json.Unmarshal(body, &exportEv); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if acc[utils.AccountField] != utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account) {
|
||||
accJson, ok := exportEv["Account"].(string)
|
||||
if !ok {
|
||||
t.Fatal("Expected Account field to be string")
|
||||
}
|
||||
var acc map[string]any
|
||||
if err := json.Unmarshal([]byte(accJson), &acc); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if acc["ID"].(string) != utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account) {
|
||||
t.Errorf("Expected %q ,received %q", utils.ConcatenatedKey(pstrAccount.Tenant, pstrAccount.Account), acc[utils.AccountField])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,26 +190,26 @@ func TestNewDataConverter(t *testing.T) {
|
||||
t.Errorf("Expected %+v received: %+v", exp, hex)
|
||||
}
|
||||
|
||||
// tm, err := NewDataConverter(MetaTimeString)
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
// expTime, err := NewTimeStringConverter(":" + time.RFC3339)
|
||||
// if !reflect.DeepEqual(tm, expTime) {
|
||||
// t.Errorf("Expected %+v received: %+v", expTime, tm)
|
||||
// }
|
||||
tm, err := NewDataConverter(MetaTimeString)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
expTime, err := NewTimeStringConverter(":" + time.DateTime)
|
||||
if !reflect.DeepEqual(tm, expTime) {
|
||||
t.Errorf("Expected %+v received: %+v", expTime, tm)
|
||||
}
|
||||
|
||||
// tm, err = NewDataConverter("*timestring::020106150400")
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// }
|
||||
// expTime, err = NewTimeStringConverter(":020106150400")
|
||||
// if err != nil {
|
||||
// t.Fatal(err)
|
||||
// }
|
||||
// if !reflect.DeepEqual(tm, expTime) {
|
||||
// t.Errorf("Expected %+v received: %+v", expTime, tm)
|
||||
// }
|
||||
tm, err = NewDataConverter("*timestring::020106150400")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
expTime, err = NewTimeStringConverter(":020106150400")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(tm, expTime) {
|
||||
t.Errorf("Expected %+v received: %+v", expTime, tm)
|
||||
}
|
||||
expected := &DurationFormatConverter{Layout: "15:04:05"}
|
||||
if durFmt, err := NewDataConverter(MetaDurationFormat + ":15:04:05"); err != nil {
|
||||
t.Error(err)
|
||||
@@ -816,81 +816,6 @@ func TestNewDataConverterMustCompile2(t *testing.T) {
|
||||
NewDataConverterMustCompile(MetaMultiply)
|
||||
}
|
||||
|
||||
// func TestNewTimeStringConverter(t *testing.T) {
|
||||
// //empty
|
||||
// // eOut := &TimeStringConverter{layout: EmptyString}
|
||||
// // if rcv, err := NewTimeStringConverter(EmptyString); err != nil {
|
||||
// // t.Error(err)
|
||||
// // } else if !reflect.DeepEqual(eOut, rcv) {
|
||||
// // t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
|
||||
// // }
|
||||
|
||||
// //default
|
||||
// // eOut = &TimeStringConverter{layout: time.RFC3339}
|
||||
// // var rcv DataConverter
|
||||
// // if rcv, err := NewTimeStringConverter(":" + time.RFC3339); err != nil {
|
||||
// // t.Error(err)
|
||||
// // } else if !reflect.DeepEqual(eOut, rcv) {
|
||||
// // t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
|
||||
// // }
|
||||
// exp := "2015-07-07T14:52:08Z"
|
||||
// if rcv, err := rcv.Convert("1436280728"); err != nil {
|
||||
// t.Error(err)
|
||||
// } else if rcv.(string) != exp {
|
||||
// t.Errorf("Expecting: %+v, received: %+v", exp, rcv)
|
||||
// }
|
||||
// exp = "2013-07-30T19:33:10Z"
|
||||
// if rcv, err := rcv.Convert("1375212790"); err != nil {
|
||||
// t.Error(err)
|
||||
// } else if rcv.(string) != exp {
|
||||
// t.Errorf("Expecting: %+v, received: %+v", exp, rcv)
|
||||
// }
|
||||
|
||||
// //other
|
||||
// eOut = &TimeStringConverter{layout: "020106150400"}
|
||||
// var err error
|
||||
// rcv, err = NewTimeStringConverter(":020106150400")
|
||||
// if err != nil {
|
||||
// t.Error(err)
|
||||
// } else if !reflect.DeepEqual(eOut, rcv) {
|
||||
// t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
|
||||
// }
|
||||
// exp = "070715145200"
|
||||
// if rcv, err := rcv.Convert("1436280728"); err != nil {
|
||||
// t.Error(err)
|
||||
// } else if rcv.(string) != exp {
|
||||
// t.Errorf("Expecting: %+v, received: %+v", exp, rcv)
|
||||
// }
|
||||
// exp = "290720175900"
|
||||
// if rcv, err := rcv.Convert("2020-07-29T17:59:59Z"); err != nil {
|
||||
// t.Error(err)
|
||||
// } else if rcv.(string) != exp {
|
||||
// t.Errorf("Expecting: %+v, received: %+v", exp, rcv)
|
||||
// }
|
||||
|
||||
// //wrong cases
|
||||
// eOut = &TimeStringConverter{layout: "not really a good time"}
|
||||
// if rcv, err := NewTimeStringConverter(":not really a good time"); err != nil {
|
||||
// t.Error(err)
|
||||
// } else if !reflect.DeepEqual(eOut, rcv) {
|
||||
// t.Errorf("Expecting: %+v, received: %+v", eOut, rcv)
|
||||
// }
|
||||
// exp = "not really a good time"
|
||||
// if rcv, err := rcv.Convert(EmptyString); err != nil {
|
||||
// t.Error(err)
|
||||
// } else if rcv.(string) != exp {
|
||||
// t.Errorf("Expecting: %+v, received: %+v", exp, rcv)
|
||||
// }
|
||||
// if rcv, err := rcv.Convert("1375212790"); err != nil {
|
||||
// t.Error(err)
|
||||
// } else if rcv.(string) != exp {
|
||||
// t.Errorf("Expecting: %+v, received: %+v", exp, rcv)
|
||||
// }
|
||||
// if _, err := rcv.Convert("137521s2790"); err == nil {
|
||||
// t.Errorf("Expected error received: %v:", err)
|
||||
// }
|
||||
// }
|
||||
|
||||
func TestStringHexConvertor(t *testing.T) {
|
||||
hx := new(String2HexConverter)
|
||||
val := "127.0.0.1"
|
||||
@@ -2015,7 +1940,7 @@ func TestDurationMinutesConverter(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLocalTimeDurationConverter(t *testing.T) {
|
||||
func TestTimeStringConverter(t *testing.T) {
|
||||
loadTimelocation := func(tzName string, year int, month time.Month, day, hour, min, sec, nsec int) time.Time {
|
||||
loc, _ := time.LoadLocation(tzName)
|
||||
return time.Date(year, month, day, hour, min, sec, nsec, loc)
|
||||
|
||||
Reference in New Issue
Block a user