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');
});
});