]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.spec.ts
import ceph 16.2.7
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / api / nfs.service.spec.ts
index 07f5a1890fbd38bce42a2bfc419fd78d995d14ee..139fa490bfd82ef1684ce9fcc5eab6a69503120a 100644 (file)
@@ -1,5 +1,5 @@
 import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
-import { TestBed } from '@angular/core/testing';
+import { fakeAsync, TestBed, tick } from '@angular/core/testing';
 
 import { configureTestBed } from '~/testing/unit-test-helper';
 import { NfsService } from './nfs.service';
@@ -46,8 +46,8 @@ describe('NfsService', () => {
   });
 
   it('should call update', () => {
-    service.update('cluster_id', 'export_id', 'foo').subscribe();
-    const req = httpTesting.expectOne('api/nfs-ganesha/export/cluster_id/export_id');
+    service.update('cluster_id', 1, 'foo').subscribe();
+    const req = httpTesting.expectOne('api/nfs-ganesha/export/cluster_id/1');
     expect(req.request.body).toEqual('foo');
     expect(req.request.method).toBe('PUT');
   });
@@ -64,27 +64,11 @@ describe('NfsService', () => {
     expect(req.request.method).toBe('GET');
   });
 
-  it('should call buckets', () => {
-    service.buckets('user_foo').subscribe();
-    const req = httpTesting.expectOne('ui-api/nfs-ganesha/rgw/buckets?user_id=user_foo');
-    expect(req.request.method).toBe('GET');
-  });
-
-  it('should call daemon', () => {
-    service.daemon().subscribe();
-    const req = httpTesting.expectOne('api/nfs-ganesha/daemon');
-    expect(req.request.method).toBe('GET');
-  });
-
-  it('should call start', () => {
-    service.start('host_name').subscribe();
-    const req = httpTesting.expectOne('api/nfs-ganesha/service/host_name/start');
-    expect(req.request.method).toBe('PUT');
-  });
-
-  it('should call stop', () => {
-    service.stop('host_name').subscribe();
-    const req = httpTesting.expectOne('api/nfs-ganesha/service/host_name/stop');
-    expect(req.request.method).toBe('PUT');
-  });
+  it('should not call lsDir if volume is not provided', fakeAsync(() => {
+    service.lsDir('', 'foo_dir').subscribe({
+      error: (error: string) => expect(error).toEqual('Please specify a filesystem volume.')
+    });
+    tick();
+    httpTesting.expectNone('ui-api/nfs-ganesha/lsdir/?root_dir=foo_dir');
+  }));
 });