Fix Create Container issues
This patch fixes container name check and Create Container action. Change-Id: Idfb90a327e94ccaa3263aaaad1d6d52fa46312f4
This commit is contained in:
parent
f044c4b0a3
commit
d8802fef6d
@ -92,7 +92,7 @@
|
||||
push.apply(model.containers, data.data.items);
|
||||
}),
|
||||
swiftAPI.getInfo().then(function onInfo(data) {
|
||||
model.swift_info = data.info;
|
||||
model.swift_info = data.data.info;
|
||||
})
|
||||
]).then(function resolve() {
|
||||
model.intialiseDeferred.resolve();
|
||||
|
@ -46,7 +46,7 @@
|
||||
expect(swiftAPI.getInfo).toHaveBeenCalled();
|
||||
expect(swiftAPI.getContainers).toHaveBeenCalled();
|
||||
|
||||
infoDeferred.resolve({info: 'spam'});
|
||||
infoDeferred.resolve({data: {info: 'spam'}});
|
||||
containersDeferred.resolve({data: {items: ['two', 'items']}});
|
||||
$rootScope.$apply();
|
||||
|
||||
|
@ -97,11 +97,11 @@
|
||||
return $q.when();
|
||||
}
|
||||
|
||||
var def = $q.defer();
|
||||
// reverse the sense here - successful lookup == error so we reject the
|
||||
// name if we find it in swift
|
||||
swiftAPI.getContainer(containerName, true).then(def.reject, def.resolve);
|
||||
return def.promise;
|
||||
return swiftAPI.getContainer(containerName, true).then(function onSuccess(response) {
|
||||
return $q.reject(response);
|
||||
}, function onError() { return true; });
|
||||
}
|
||||
|
||||
function selectContainer(container) {
|
||||
|
@ -137,7 +137,7 @@
|
||||
function getContainer(container, ignoreError) {
|
||||
var promise = apiService.get(service.getContainerURL(container) + '/metadata/');
|
||||
if (ignoreError) {
|
||||
return promise.catch(angular.noop);
|
||||
return promise;
|
||||
}
|
||||
return promise.catch(function onError() {
|
||||
toastService.add('error', gettext('Unable to get the container details.'));
|
||||
|
@ -247,7 +247,6 @@
|
||||
spyOn(promise, 'catch');
|
||||
spyOn(toastService, 'add');
|
||||
service.getContainer('spam', true);
|
||||
expect(promise.catch).toHaveBeenCalledWith(angular.noop);
|
||||
expect(toastService.add).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user