GUI -- Added mechanism to test device view.
Themed device view.
Change-Id: I471ec56b94c927d834f8067d06efce33ddfa4596
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);
- //})
});