Add api unit tests to improve coverage

Add jasmine unit tests to cover neutron.service and glance.service to
increase the code coverage, giving a little more breathing room over the
minimum thresholds.

Change-Id: Ibcb1dc390584b3e6a15e22c62c42eb5392501a19
This commit is contained in:
Gary Smith 2017-05-31 17:07:48 -07:00
parent 15c5aa4ecd
commit a25670fd42
2 changed files with 29 additions and 0 deletions

View File

@ -251,6 +251,17 @@
);
});
it('second call is not started if image creation returns no upload_url', function() {
var missingUrl = {
'name': imageData.name,
'token_id': 'my token'
};
imageQueuedPromise.resolve({data: missingUrl});
$rootScope.$apply();
expect(apiService.put.calls.count()).toBe(1);
});
it('sends back upload progress', function() {
imageQueuedPromise.resolve({data: queuedImage});
$rootScope.$apply();
@ -262,6 +273,7 @@
loaded: 2,
total: 2
});
imageUploadPromise.resolve();
$rootScope.$apply();
expect(onProgress.calls.allArgs()).toEqual([[50], [100]]);

View File

@ -93,6 +93,13 @@
}
]
},
{
"func": "getPorts",
"method": "get",
"path": "/api/neutron/ports/",
"data": {},
"error": "Unable to retrieve the ports."
},
{
"func": "getAgents",
"method": "get",
@ -132,6 +139,16 @@
"path": "/api/neutron/trunks/",
"data": {},
"error": "Unable to retrieve the trunks."
},
{
"func": "getTrunks",
"method": "get",
"path": "/api/neutron/trunks/",
"data": {"params": 42},
"error": "Unable to retrieve the trunks.",
"testInput": [
42
]
}
];