formHelper.expectValid('user_id');
}));
+ it('should validate that username can contain dot(.)', fakeAsync(() => {
+ spyOn(rgwUserService, 'get').and.returnValue(throwError('foo'));
+ formHelper.setValue('user_id', 'user.name', true);
+ tick(DUE_TIMER);
+ formHelper.expectValid('user_id');
+ }));
+
it('should validate that username is invalid', fakeAsync(() => {
spyOn(rgwUserService, 'get').and.returnValue(observableOf({}));
formHelper.setValue('user_id', 'abc', true);
}));
});
+ describe('tenant validation', () => {
+ it('should validate that tenant is valid', fakeAsync(() => {
+ spyOn(rgwUserService, 'get').and.returnValue(throwError('foo'));
+ formHelper.setValue('show_tenant', true, true);
+ formHelper.setValue('tenant', 'new_tenant123', true);
+ tick(DUE_TIMER);
+ formHelper.expectValid('tenant');
+ }));
+
+ it('should validate that tenant is invalid', fakeAsync(() => {
+ spyOn(rgwUserService, 'get').and.returnValue(observableOf({}));
+ formHelper.setValue('show_tenant', true, true);
+ formHelper.setValue('tenant', 'new-tenant.dummy', true);
+ tick(DUE_TIMER);
+ formHelper.expectError('tenant', 'pattern');
+ }));
+ });
+
describe('max buckets', () => {
beforeEach(() => {
component.loading = LoadingStatus.Ready;
// General
user_id: [
null,
- [Validators.required, Validators.pattern(/^[a-zA-Z0-9!@#%^&*()_-]+$/)],
+ [Validators.required, Validators.pattern(/^[a-zA-Z0-9!@#%^&*()._-]+$/)],
this.editing
? []
: [
show_tenant: [this.editing],
tenant: [
null,
- [Validators.pattern(/^[a-zA-Z0-9!@#%^&*()_-]+$/)],
+ [Validators.pattern(/^[a-zA-Z0-9_]+$/)],
this.editing
? []
: [