GUI -- Added mechanism to test device view.
Themed device view.

Change-Id: I471ec56b94c927d834f8067d06efce33ddfa4596
diff --git a/web/gui/src/main/webapp/tests/app/fw/remote/rest-spec.js b/web/gui/src/main/webapp/tests/app/fw/remote/rest-spec.js
index ecfcba7..5537d88 100644
--- a/web/gui/src/main/webapp/tests/app/fw/remote/rest-spec.js
+++ b/web/gui/src/main/webapp/tests/app/fw/remote/rest-spec.js
@@ -25,6 +25,16 @@
 
     beforeEach(module('onosUtil', 'onosRemote'));
 
+    beforeEach(module(function($provide) {
+        $provide.factory('$location', function (){
+            return {
+                protocol: function () { return 'http'; },
+                host: function () { return 'foo'; },
+                port: function () { return '80'; }
+            };
+        })
+    }));
+
     beforeEach(inject(function (_$log_, _$httpBackend_, FnService, RestService) {
         $log = _$log_;
         $httpBackend = _$httpBackend_;
@@ -50,10 +60,10 @@
     it('should fetch remote data', function () {
         var called = 0,
             capture = null;
-        $httpBackend.expectGET('/bar').respond(mockData);
+        $httpBackend.whenGET(/.*/).respond(mockData);
         spyOn($log, 'warn');
 
-        rs.get('/bar', function (data) {
+        rs.get('bar', function (data) {
             called++;
             capture = data;
         });
@@ -69,10 +79,10 @@
     it('should fail to fetch remote data', function () {
         var called = 0,
             capture = null;
-        $httpBackend.expectGET('/bar').respond(404, 'Not Found');
+        $httpBackend.whenGET(/.*/).respond(404, 'Not Found');
         spyOn($log, 'warn');
 
-        rs.get('/bar', function (data) {
+        rs.get('bar', function (data) {
             called++;
             capture = data;
         });
@@ -82,9 +92,8 @@
         $httpBackend.flush();
         expect(called).toEqual(0);
         expect(capture).toBeNull();
-        expect($log.warn)
-            .toHaveBeenCalledWith('Failed to retrieve JSON data: /bar',
-                                    404, 'Not Found');
+        expect($log.warn).toHaveBeenCalledWith(
+            'Failed to retrieve JSON data: http://foo:80/ui/rs/bar', 404, 'Not Found');
     });
 
 });
diff --git a/web/gui/src/main/webapp/tests/app/fw/remote/urlfn-spec.js b/web/gui/src/main/webapp/tests/app/fw/remote/urlfn-spec.js
index 764d43e..aa3f28e 100644
--- a/web/gui/src/main/webapp/tests/app/fw/remote/urlfn-spec.js
+++ b/web/gui/src/main/webapp/tests/app/fw/remote/urlfn-spec.js
@@ -28,7 +28,7 @@
     beforeEach(module(function($provide) {
        $provide.factory('$location', function (){
         return {
-            protocol: function () { return '$http'; },
+            protocol: function () { return 'http'; },
             host: function () { return 'foo'; },
             port: function () { return '80'; }
         };
@@ -53,6 +53,6 @@
     });
 
     it('should build the url prefix', function () {
-       expect(ufs.urlPrefix()).toEqual('$http://foo:80');
+       expect(ufs.urlPrefix()).toEqual('http://foo:80');
     });
 });
diff --git a/web/gui/src/main/webapp/tests/app/view/device/device-spec.js b/web/gui/src/main/webapp/tests/app/view/device/device-spec.js
index 86c7db7..503688a 100644
--- a/web/gui/src/main/webapp/tests/app/view/device/device-spec.js
+++ b/web/gui/src/main/webapp/tests/app/view/device/device-spec.js
@@ -21,58 +21,40 @@
  */
 describe('Controller: OvDeviceCtrl', function () {
     // instantiate the Device module
-    beforeEach(module('ovDevice'));
+    beforeEach(module('ovDevice', 'onosRemote'));
 
     var $log, $controller, ctrl, $mockHttp;
 
     var fakeData = {
-        "devices": [
-        {
+        "devices": [{
             "id": "of:0000000000000001",
             "available": true,
-            "role": "MASTER",
             "mfr": "Nicira, Inc.",
             "hw": "Open vSwitch",
-            "sw": "2.0.1",
-            "serial": "None",
-            "annotations": {
-                "protocol": "OF_10"
-            }
+            "sw": "2.0.1"
         },
         {
             "id": "of:0000000000000004",
             "available": true,
-            "role": "MASTER",
             "mfr": "Nicira, Inc.",
             "hw": "Open vSwitch",
-            "sw": "2.0.1",
-            "serial": "None",
-            "annotations": {
-                "protocol": "OF_10"
-            }
+            "sw": "2.0.1"
         }]
     };
 
-    // we need an instance of the controller
     beforeEach(inject(function(_$log_, _$controller_, $httpBackend) {
         $log = _$log_;
         $controller = _$controller_;
         $mockHttp = $httpBackend;
 
-        $mockHttp.whenGET(/devices/).respond(fakeData);
-
+        $mockHttp.whenGET(/\/device$/).respond(fakeData);
     }));
 
-    //afterEach($mockHttp.resetExpectations);
-
     it('should be an empty array', function () {
         ctrl = $controller('OvDeviceCtrl');
         expect(ctrl.deviceData).toEqual([]);
+        $mockHttp.flush();
+        expect(ctrl.deviceData).toEqual(fakeData.devices);
     });
 
-    //it('should have data in it', function () {
-    //    ctrl = $controller('OvDeviceCtrl');
-    //    //$mockHttp.flush();
-    //    expect(ctrl.deviceData).toEqual(fakeData.devices);
-    //})
 });