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
@@ -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])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user