]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / pool / pool-list / pool-list.component.spec.ts
index db850079f631cb8b54253c646822ed5850bb5741..3a365223ffd90dec8b5bc506d4bd1c01770451a0 100644 (file)
@@ -17,6 +17,7 @@ import { ConfigurationService } from '../../../shared/api/configuration.service'
 import { PoolService } from '../../../shared/api/pool.service';
 import { CriticalConfirmationModalComponent } from '../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
 import { ExecutingTask } from '../../../shared/models/executing-task';
+import { AuthStorageService } from '../../../shared/services/auth-storage.service';
 import { SummaryService } from '../../../shared/services/summary.service';
 import { TaskWrapperService } from '../../../shared/services/task-wrapper.service';
 import { SharedModule } from '../../../shared/shared.module';
@@ -75,9 +76,14 @@ describe('PoolListComponent', () => {
   });
 
   describe('monAllowPoolDelete', () => {
+    let configOptRead: boolean;
     let configurationService: ConfigurationService;
 
     beforeEach(() => {
+      configOptRead = true;
+      spyOn(TestBed.get(AuthStorageService), 'getPermissions').and.callFake(() => ({
+        configOpt: { read: configOptRead }
+      }));
       configurationService = TestBed.get(ConfigurationService);
     });
 
@@ -122,6 +128,13 @@ describe('PoolListComponent', () => {
       component = fixture.componentInstance;
       expect(component.monAllowPoolDelete).toBe(false);
     });
+
+    it('should set value correctly w/o config-opt read privileges', () => {
+      configOptRead = false;
+      fixture = TestBed.createComponent(PoolListComponent);
+      component = fixture.componentInstance;
+      expect(component.monAllowPoolDelete).toBe(false);
+    });
   });
 
   describe('pool deletion', () => {