github.com/mdaxf/iac@v0.0.0-20240519030858-58a061660378/integration/mqttclient/mqttclient_test.go (about) 1 package mqttclient 2 3 import ( 4 "crypto/x509" 5 "database/sql" 6 "reflect" 7 "testing" 8 9 "github.com/mdaxf/iac/documents" 10 "github.com/mdaxf/iac-signalr/signalr" 11 ) 12 13 func TestNewMqttClientbyExternal(t *testing.T) { 14 type args struct { 15 configurations Mqtt 16 DB *sql.DB 17 DocDBconn *documents.DocDB 18 SignalRClient signalr.Client 19 } 20 tests := []struct { 21 name string 22 args args 23 want *MqttClient 24 }{ 25 // TODO: Add test cases. 26 } 27 for _, tt := range tests { 28 t.Run(tt.name, func(t *testing.T) { 29 if got := NewMqttClientbyExternal(tt.args.configurations, tt.args.DB, tt.args.DocDBconn, tt.args.SignalRClient); !reflect.DeepEqual(got, tt.want) { 30 t.Errorf("NewMqttClientbyExternal() = %v, want %v", got, tt.want) 31 } 32 }) 33 } 34 } 35 36 func TestMqttClient_Initialize_mqttClient(t *testing.T) { 37 tests := []struct { 38 name string 39 mqttClient *MqttClient 40 }{ 41 // TODO: Add test cases. 42 } 43 for _, tt := range tests { 44 t.Run(tt.name, func(t *testing.T) { 45 tt.mqttClient.Initialize_mqttClient() 46 }) 47 } 48 } 49 50 func TestMqttClient_Publish(t *testing.T) { 51 type args struct { 52 topic string 53 payload string 54 } 55 tests := []struct { 56 name string 57 mqttClient *MqttClient 58 args args 59 }{ 60 // TODO: Add test cases. 61 } 62 for _, tt := range tests { 63 t.Run(tt.name, func(t *testing.T) { 64 tt.mqttClient.Publish(tt.args.topic, tt.args.payload) 65 }) 66 } 67 } 68 69 func TestMqttClient_loadCACert(t *testing.T) { 70 type args struct { 71 caCertFile string 72 } 73 tests := []struct { 74 name string 75 mqttClient *MqttClient 76 args args 77 want *x509.CertPool 78 }{ 79 // TODO: Add test cases. 80 } 81 for _, tt := range tests { 82 t.Run(tt.name, func(t *testing.T) { 83 if got := tt.mqttClient.loadCACert(tt.args.caCertFile); !reflect.DeepEqual(got, tt.want) { 84 t.Errorf("MqttClient.loadCACert() = %v, want %v", got, tt.want) 85 } 86 }) 87 } 88 } 89 90 func TestMqttClient_waitForTerminationSignal(t *testing.T) { 91 tests := []struct { 92 name string 93 mqttClient *MqttClient 94 }{ 95 // TODO: Add test cases. 96 } 97 for _, tt := range tests { 98 t.Run(tt.name, func(t *testing.T) { 99 tt.mqttClient.waitForTerminationSignal() 100 }) 101 } 102 }