Get interface for subscriptions
Change-Id: I11d351c6e3de9fcdc1f4e1a7937054c091bd870e
Signed-off-by: Mohamed Abukar <abukar.mohamed@nokia.com>
diff --git a/pkg/xapp/subscription_test.go b/pkg/xapp/subscription_test.go
index 28549e7..5ebb9c2 100755
--- a/pkg/xapp/subscription_test.go
+++ b/pkg/xapp/subscription_test.go
@@ -59,14 +59,35 @@
return models.SubscriptionResult{11, 22, 33}, nil
}
+func queryHandler() (models.SubscriptionList, error) {
+ resp := models.SubscriptionList{
+ &models.SubscriptionData{
+ SubscriptionID: 11,
+ Meid: "Test-Gnb",
+ Endpoint: []string{"127.0.0.1:4056"},
+ },
+ }
+
+ return resp, nil
+}
+
func TestSetup(t *testing.T) {
suite = t
// Start the server to simulate SubManager
- go Subscription.Listen(subscriptionHandler)
+ go Subscription.Listen(subscriptionHandler, queryHandler)
time.Sleep(time.Duration(2) * time.Second)
}
+func TestSubscriptionQueryHandling(t *testing.T) {
+ resp, err := Subscription.QuerySubscriptions()
+
+ assert.Equal(t, err, nil)
+ assert.Equal(t, resp[0].SubscriptionID, int64(11))
+ assert.Equal(t, resp[0].Meid, "Test-Gnb")
+ assert.Equal(t, resp[0].Endpoint, []string{"127.0.0.1:4056"})
+}
+
func TestSubscriptionReportHandling(t *testing.T) {
result, err := Subscription.SubscribeReport(&reportParams)