Skip to content
Snippets Groups Projects
Commit 6ebd2b5d authored by OZGCloud's avatar OZGCloud
Browse files

OZG-4870 add test shouldCreateRealmWithSpecWithoutSMTPServer and cleanup

parent fff26cd8
No related branches found
No related tags found
No related merge requests found
......@@ -103,7 +103,7 @@ class KeycloakRealmMapperTest {
var mapped = mapper.map(OzgCloudKeycloakRealmSpecTestFactory.create());
var mappedSmtpServer = mapped.getSmtpServer();
assertThat(mappedSmtpServer.get("host")).isEqualTo(KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_HOST);
assertThat(mappedSmtpServer.get("port")).isEqualTo("432");
assertThat(mappedSmtpServer.get("port")).isEqualTo(KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_PORT);
assertThat(mappedSmtpServer.get("password")).isEqualTo(KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_PASSWORD);
assertThat(mappedSmtpServer.get("user")).isEqualTo(KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_USER);
assertThat(mappedSmtpServer.get("starttls")).isEqualTo(KeycloakRealmSmtpServerTestFactory.SMTP_SERVER_STARTTLS);
......@@ -113,13 +113,4 @@ class KeycloakRealmMapperTest {
}
@Test
void shouldNotThrowOnRealmWithoutSMTP() {
//create realm without SMTP Servr configs
OzgCloudKeycloakRealm realm = OzgCloudKeycloakRealmTestFactory.create();
assertDoesNotThrow(() -> mapper.map(realm.getSpec()));
}
}
......@@ -73,9 +73,12 @@ class KeycloakRealmReconcilerTest {
}
@Test
void shouldCreateRealmWithSpecWithoutSMTPConfig() {
var response = reconciler.reconcile(OzgCloudKeycloakRealmTestFactory.create(), null);
assertThat(response.getResource().getStatus().getStatus()).isEqualTo(OzgCloudCustomResourceStatus.OK);
void shouldCreateRealmWithSpecWithoutSMTPServer() {
OzgCloudKeycloakRealm realm = OzgCloudKeycloakRealmTestFactory.create();
reconciler.reconcile(realm, null);
var spec = realm.getSpec();
spec.setSmtpServer(null);
verify(service).createRealm(spec, OzgCloudKeycloakRealmTestFactory.METADATA_NAMESPACE);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment