Merge "RIC:1060: Change in PTL"
[ric-plt/alarm-go.git] / manager / cmd / restapi_test.go
index 90954af..b1c175c 100755 (executable)
@@ -23,12 +23,12 @@ package main
 import (
        "bytes"
        "encoding/json"
-       "github.com/stretchr/testify/assert"
        "net/http"
        "net/http/httptest"
        "testing"
 
-       "gerrit.o-ran-sc.org/r/ric-plt/alarm-go/alarm"
+       "gerrit.o-ran-sc.org/r/ric-plt/alarm-go.git/alarm"
+       "github.com/stretchr/testify/assert"
 )
 
 // Test cases
@@ -47,7 +47,7 @@ func TestGetActiveAlarmsRESTInterface(t *testing.T) {
 }
 
 func TestRaiseAlarmRESTInterface(t *testing.T) {
-       a := alarmer.NewAlarm(alarm.RIC_RT_DISTRIBUTION_FAILED, alarm.SeverityMajor, "Some App data", "eth 0 1")
+       a := alarmer.NewAlarm(alarm.E2_CONNECTION_PROBLEM, alarm.SeverityMajor, "Some App data", "eth 0 1")
        b, err := json.Marshal(&a)
        if err != nil {
                t.Errorf("Unexpected error %v", err)
@@ -67,7 +67,7 @@ func TestRaiseAlarmRESTInterface(t *testing.T) {
 }
 
 func TestClearAlarmRESTInterface(t *testing.T) {
-       a := alarmer.NewAlarm(alarm.RIC_RT_DISTRIBUTION_FAILED, alarm.SeverityMajor, "Some App data", "eth 0 1")
+       a := alarmer.NewAlarm(alarm.E2_CONNECTION_PROBLEM, alarm.SeverityMajor, "Some App data", "eth 0 1")
        b, err := json.Marshal(&a)
        if err != nil {
                t.Errorf("Unexpected error %v", err)
@@ -85,3 +85,17 @@ func TestClearAlarmRESTInterface(t *testing.T) {
        assert.Equal(t, true, rr != nil)
        assert.Equal(t, rr.Code, http.StatusOK)
 }
+
+func TestSymptomDataHandler(t *testing.T) {
+       req, err := http.NewRequest("POST", "/ric/v1/symptomdata", nil)
+       if err != nil {
+               t.Fatal(err)
+       }
+
+       rr := httptest.NewRecorder()
+       handler := http.HandlerFunc(alarmManager.SymptomDataHandler)
+       handler.ServeHTTP(rr, req)
+
+       assert.Equal(t, true, rr != nil)
+       assert.Equal(t, rr.Code, http.StatusOK)
+}