3205
describe("getCannotCreateBcacheMsg", function() {
3207
it("returns msg if no cachesets",
3209
var controller = makeController();
3210
$scope.available = [
3214
has_partitions: false
3217
$scope.cachesets = [];
3218
expect($scope.getCannotCreateBcacheMsg()).toBe(
3219
"Create at least one cache set to create bcache");
3222
it("returns msg if two selected", function() {
3223
var controller = makeController();
3224
$scope.cachesets = [{}];
3225
$scope.available = [ { $selected: true }, { $selected: true }];
3226
expect($scope.getCannotCreateBcacheMsg()).toBe(
3227
"Select only one available device to create bcache");
3230
it("returns msg if selected has fstype", function() {
3231
var controller = makeController();
3232
$scope.available = [
3236
has_partitions: false
3239
$scope.cachesets = [{}];
3241
expect($scope.getCannotCreateBcacheMsg()).toBe(
3242
"Device is formatted; unformat the device to create bcache");
3245
it("returns msg if selected is volume group", function() {
3246
var controller = makeController();
3247
$scope.available = [
3252
has_partitions: false
3255
$scope.cachesets = [{}];
3256
expect($scope.getCannotCreateBcacheMsg()).toBe(
3257
"Cannot use a logical volume as a backing device for bcache.");
3260
it("returns msg if selected has partitions", function() {
3261
var controller = makeController();
3262
$scope.available = [
3266
has_partitions: true
3269
$scope.cachesets = [{}];
3270
expect($scope.getCannotCreateBcacheMsg()).toBe(
3271
"Device has already been partitioned; create a " +
3272
"new partition to use as the bcache backing " +
3276
it("returns null if selected is valid",
3278
var controller = makeController();
3279
$scope.available = [
3283
has_partitions: false
3286
$scope.cachesets = [{}];
3287
expect($scope.getCannotCreateBcacheMsg()).toBeNull();
3205
3291
describe("canCreateBcache", function() {
3207
3293
it("returns false when isAvailableDisabled is true", function() {
3244
3331
type: "lvm-vg",
3334
has_partitions: false
3337
$scope.cachesets = [{}];
3338
$scope.isSuperUser = function() { return true; };
3340
expect($scope.canCreateBcache()).toBe(false);
3343
it("returns false if selected has partitions", function() {
3344
var controller = makeController();
3345
spyOn($scope, "isAvailableDisabled").and.returnValue(false);
3346
$scope.available = [
3350
has_partitions: true
3249
3353
$scope.cachesets = [{}];