]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/host.service.spec.ts
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / api / host.service.spec.ts
index a98eb78bfaae8c6586e8995ffb703bf16e5cf7b5..8a7de5e25d6341b3da26067126c49cb0114ad4af 100644 (file)
@@ -1,7 +1,7 @@
 import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
 import { fakeAsync, TestBed, tick } from '@angular/core/testing';
 
-import { configureTestBed } from '../../../testing/unit-test-helper';
+import { configureTestBed } from '~/testing/unit-test-helper';
 import { HostService } from './host.service';
 
 describe('HostService', () => {
@@ -14,8 +14,8 @@ describe('HostService', () => {
   });
 
   beforeEach(() => {
-    service = TestBed.get(HostService);
-    httpTesting = TestBed.get(HttpTestingController);
+    service = TestBed.inject(HostService);
+    httpTesting = TestBed.inject(HttpTestingController);
   });
 
   afterEach(() => {
@@ -44,9 +44,34 @@ describe('HostService', () => {
   });
 
   it('should update host', fakeAsync(() => {
-    service.update('mon0', ['foo', 'bar']).subscribe();
+    service.update('mon0', true, ['foo', 'bar']).subscribe();
     const req = httpTesting.expectOne('api/host/mon0');
     expect(req.request.method).toBe('PUT');
-    expect(req.request.body).toEqual({ labels: ['foo', 'bar'] });
+    expect(req.request.body).toEqual({
+      force: false,
+      labels: ['foo', 'bar'],
+      maintenance: false,
+      update_labels: true
+    });
   }));
+
+  it('should call getInventory', () => {
+    service.getInventory('host-0').subscribe();
+    let req = httpTesting.expectOne('api/host/host-0/inventory');
+    expect(req.request.method).toBe('GET');
+
+    service.getInventory('host-0', true).subscribe();
+    req = httpTesting.expectOne('api/host/host-0/inventory?refresh=true');
+    expect(req.request.method).toBe('GET');
+  });
+
+  it('should call inventoryList', () => {
+    service.inventoryList().subscribe();
+    let req = httpTesting.expectOne('ui-api/host/inventory');
+    expect(req.request.method).toBe('GET');
+
+    service.inventoryList(true).subscribe();
+    req = httpTesting.expectOne('ui-api/host/inventory?refresh=true');
+    expect(req.request.method).toBe('GET');
+  });
 });