X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fpybind%2Fmgr%2Fdashboard%2Ffrontend%2Fsrc%2Fapp%2Fceph%2Fblock%2Fiscsi-target-discovery-modal%2Fiscsi-target-discovery-modal.component.spec.ts;h=2f232513bed8a7db3fd5ed985da255d6b334c580;hb=1911f103e16ae0d04db10fb41db8217ef4c320d3;hp=ff683b9c87c8b75d2fbf0db079f555b807d21f51;hpb=78f773100ed5d2ebc9d99e65a3d7e3a6f541a97e;p=ceph.git diff --git a/ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts b/ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts index ff683b9c8..2f232513b 100644 --- a/ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts +++ b/ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts @@ -11,7 +11,12 @@ import { RouterTestingModule } from '@angular/router/testing'; import { BsModalRef } from 'ngx-bootstrap/modal'; import { ToastrModule } from 'ngx-toastr'; -import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper'; +import { + configureTestBed, + FormHelper, + i18nProviders, + IscsiHelper +} from '../../../../testing/unit-test-helper'; import { Permission } from '../../../shared/models/permissions'; import { SharedModule } from '../../../shared/shared.module'; import { IscsiTargetDiscoveryModalComponent } from './iscsi-target-discovery-modal.component'; @@ -117,4 +122,17 @@ describe('IscsiTargetDiscoveryModalComponent', () => { expect(elemDisabled('input#mutual_password')).toBeTruthy(); expect(elem('cd-submit-button')).toBeNull(); }); + + it('should validate authentication', () => { + component.permission = new Permission(['read', 'create', 'update', 'delete']); + fixture.detectChanges(); + const control = component.discoveryForm; + const formHelper = new FormHelper(control); + formHelper.expectValid(control); + + IscsiHelper.validateUser(formHelper, 'user'); + IscsiHelper.validatePassword(formHelper, 'password'); + IscsiHelper.validateUser(formHelper, 'mutual_user'); + IscsiHelper.validatePassword(formHelper, 'mutual_password'); + }); });