Rename variable for testing

This commit is contained in:
Radhi Fadlillah
2017-05-22 22:34:03 +07:00
parent 41874e9ac7
commit 34d27b75c9
2 changed files with 9 additions and 9 deletions

View File

@@ -6,14 +6,10 @@ import (
"testing" "testing"
) )
var defaultDevice = Device{
XAddr: "http://192.168.1.75:5000/onvif/device_service",
}
func TestGetInformation(t *testing.T) { func TestGetInformation(t *testing.T) {
log.Println("Test GetInformation") log.Println("Test GetInformation")
res, err := defaultDevice.GetInformation() res, err := testDevice.GetInformation()
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
@@ -25,7 +21,7 @@ func TestGetInformation(t *testing.T) {
func TestGetCapabilities(t *testing.T) { func TestGetCapabilities(t *testing.T) {
log.Println("Test GetCapabilities") log.Println("Test GetCapabilities")
res, err := defaultDevice.GetCapabilities() res, err := testDevice.GetCapabilities()
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
@@ -37,7 +33,7 @@ func TestGetCapabilities(t *testing.T) {
func TestGetDiscoveryMode(t *testing.T) { func TestGetDiscoveryMode(t *testing.T) {
log.Println("Test GetDiscoveryMode") log.Println("Test GetDiscoveryMode")
res, err := defaultDevice.GetDiscoveryMode() res, err := testDevice.GetDiscoveryMode()
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
@@ -48,7 +44,7 @@ func TestGetDiscoveryMode(t *testing.T) {
func TestGetScopes(t *testing.T) { func TestGetScopes(t *testing.T) {
log.Println("Test GetScopes") log.Println("Test GetScopes")
res, err := defaultDevice.GetScopes() res, err := testDevice.GetScopes()
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
@@ -60,7 +56,7 @@ func TestGetScopes(t *testing.T) {
func TestGetHostname(t *testing.T) { func TestGetHostname(t *testing.T) {
log.Println("Test GetHostname") log.Println("Test GetHostname")
res, err := defaultDevice.GetHostname() res, err := testDevice.GetHostname()
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }

View File

@@ -5,6 +5,10 @@ import (
"strings" "strings"
) )
var testDevice = Device{
XAddr: "http://192.168.1.75:5000/onvif/device_service",
}
func interfaceToString(src interface{}) string { func interfaceToString(src interface{}) string {
str, _ := src.(string) str, _ := src.(string)
return str return str