use of cz.metacentrum.perun.core.bl.PerunBl in project perun by CESNET.
the class urn_perun_user_attribute_def_def_preferredShellsTest method setUp.
@Before
public void setUp() {
classInstance = new urn_perun_user_attribute_def_def_preferredShells();
session = mock(PerunSessionImpl.class, RETURNS_DEEP_STUBS);
user = new User();
attributeToCheck = new Attribute();
PerunBl perunBl = mock(PerunBl.class);
when(session.getPerunBl()).thenReturn(perunBl);
ModulesUtilsBl modulesUtilsBl = mock(ModulesUtilsBl.class);
when(perunBl.getModulesUtilsBl()).thenReturn(modulesUtilsBl);
}
use of cz.metacentrum.perun.core.bl.PerunBl in project perun by CESNET.
the class urn_perun_user_attribute_def_def_cnCeitecADTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_user_attribute_def_def_cnCeitecAD();
session = mock(PerunSessionImpl.class);
user = new User(0, "John", "Doe", "", "", "");
secondUser = new User(1, "Jane", "Doe", "", "", "");
attributeToCheck = new Attribute();
attributeToCheck.setValue("něco");
PerunBl perunBl = mock(PerunBl.class);
when(session.getPerunBl()).thenReturn(perunBl);
UsersManagerBl usersManagerBl = mock(UsersManagerBl.class);
when(session.getPerunBl().getUsersManagerBl()).thenReturn(usersManagerBl);
}
use of cz.metacentrum.perun.core.bl.PerunBl in project perun by CESNET.
the class urn_perun_user_attribute_def_def_login_namespace_ceitecTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_user_attribute_def_def_login_namespace_ceitec();
session = mock(PerunSessionImpl.class);
user = new User();
attributeToCheck = new Attribute();
attributeToCheck.setNamespace(AttributesManager.NS_USER_ATTR_DEF);
attributeToCheck.setFriendlyName("login-namespace:ceitec");
PerunBl perunBl = mock(PerunBl.class);
when(session.getPerunBl()).thenReturn(perunBl);
UsersManagerBl usersManagerBl = mock(UsersManagerBl.class);
when(session.getPerunBl().getUsersManagerBl()).thenReturn(usersManagerBl);
PasswordManagerModule module = mock(GenericPasswordManagerModule.class);
when(session.getPerunBl().getUsersManagerBl().getPasswordManagerModule(session, "ceitec")).thenReturn(module);
ModulesUtilsBl modulesUtilsBl = mock(ModulesUtilsBl.class);
when(perunBl.getModulesUtilsBl()).thenReturn(modulesUtilsBl);
}
use of cz.metacentrum.perun.core.bl.PerunBl in project perun by CESNET.
the class urn_perun_user_attribute_def_def_login_namespace_einfraTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_user_attribute_def_def_login_namespace_einfra();
session = mock(PerunSessionImpl.class, RETURNS_DEEP_STUBS);
attributeToCheck = new Attribute();
attributeToCheck.setNamespace(AttributesManager.NS_USER_ATTR_DEF);
attributeToCheck.setFriendlyName("login-namespace:einfra");
attributeToCheck.setValue("test");
PerunBl perunBl = mock(PerunBl.class);
when(session.getPerunBl()).thenReturn(perunBl);
UsersManagerBl usersManagerBl = mock(UsersManagerBl.class);
when(session.getPerunBl().getUsersManagerBl()).thenReturn(usersManagerBl);
PasswordManagerModule module = mock(EinfraPasswordManagerModule.class);
when(session.getPerunBl().getUsersManagerBl().getPasswordManagerModule(session, "einfra")).thenReturn(module);
ModulesUtilsBl modulesUtilsBlSpy = spy(mock(ModulesUtilsBl.class));
when(session.getPerunBl().getModulesUtilsBl()).thenReturn(modulesUtilsBlSpy);
Mockito.doThrow(InvalidLoginException.class).when(modulesUtilsBlSpy).checkLoginNamespaceRegex(eq("einfra"), // negated einfra check
ArgumentMatchers.matches("(?!^[a-z][a-z0-9_-]{1,14}$)"), ArgumentMatchers.any(Pattern.class));
}
use of cz.metacentrum.perun.core.bl.PerunBl in project perun by CESNET.
the class urn_perun_user_attribute_def_def_userPreferredCertDNTest method setUp.
@Before
public void setUp() throws Exception {
classInstance = new urn_perun_user_attribute_def_def_userPreferredCertDN();
session = mock(PerunSessionImpl.class);
user = new User(0, "John", "Doe", "", "", "");
attributeToCheck = new Attribute();
reqAttribute = new Attribute();
PerunBl perunBl = mock(PerunBl.class);
when(session.getPerunBl()).thenReturn(perunBl);
AttributesManagerBl attributesManagerBl = mock(AttributesManagerBl.class);
when(session.getPerunBl().getAttributesManagerBl()).thenReturn(attributesManagerBl);
when(session.getPerunBl().getAttributesManagerBl().getAttribute(session, user, AttributesManager.NS_USER_ATTR_DEF + ":userCertDNs")).thenReturn(reqAttribute);
}
Aggregations