Skip to content
Snippets Groups Projects
Commit 5bc38672 authored by Felix Reichenbach's avatar Felix Reichenbach
Browse files

Merge branch 'OZG-7161-impressum-link' into 'main'

Ozg 7161 impressum link

See merge request !10
parents 9f7ab927 0c9a8701
No related branches found
No related tags found
1 merge request!10Ozg 7161 impressum link
......@@ -28,6 +28,8 @@ import java.util.Objects;
import org.springframework.boot.info.BuildProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
......@@ -40,6 +42,9 @@ public class Root {
private boolean production;
@Getter
private String barrierefreiheitUrl;
@Getter
@JsonInclude(JsonInclude.Include.NON_NULL)
private String impressumUrl;
public String getVersion() {
return Objects.isNull(buildProperties) ? "--" : buildProperties.getVersion();
......
......@@ -57,6 +57,7 @@ public class RootController {
.buildProperties(buildProperties)
.production(production)
.barrierefreiheitUrl(rootProperties.getBarrierefreiheitUrl())
.impressumUrl(rootProperties.getImpressumUrl())
.build();
}
}
\ No newline at end of file
......@@ -13,8 +13,14 @@ import lombok.Setter;
class RootProperties {
/**
* URL pointing to the site with information about accessibility (Barrierefreiheit).
* URL pointing to the site with information about accessibility
* (Barrierefreiheit).
*/
private String barrierefreiheitUrl;
/**
* URL pointing to the impressum.
*/
private String impressumUrl;
}
......@@ -106,6 +106,22 @@ class RootControllerTest {
doRequest().andExpect(jsonPath("$.barrierefreiheitUrl").value(RootTestFactory.BARRIEREFREIHEIT_URL));
}
@SneakyThrows
@Test
void shouldHaveImpressumUrl() {
when(rootProperties.getImpressumUrl()).thenReturn(RootTestFactory.IMPRESSUM_URL);
doRequest().andExpect(jsonPath("$.impressumUrl").value(RootTestFactory.IMPRESSUM_URL));
}
@SneakyThrows
@Test
void shouldNotHaveImpressumUrl() {
when(rootProperties.getImpressumUrl()).thenReturn(null);
doRequest().andExpect(jsonPath("$.impressumUrl").doesNotHaveJsonPath());
}
private ResultActions doRequest() throws Exception {
return mockMvc.perform(get(RootController.PATH)).andExpect(status().isOk());
}
......
......@@ -23,9 +23,12 @@
*/
package de.ozgcloud.alfa;
import com.thedeanda.lorem.LoremIpsum;
public class RootTestFactory {
public static final String BARRIEREFREIHEIT_URL = "https://barrierefreiheit.de/";
public static final String IMPRESSUM_URL = LoremIpsum.getInstance().getUrl();
public static Root create() {
return createBuilder().build();
......
......@@ -125,6 +125,10 @@ spec:
{{- end }}
- name: ozgcloud_barrierefreiheitUrl
value: {{ required "ozgcloud.barrierefreiheitUrl muss angegeben sein" (.Values.ozgcloud).barrierefreiheitUrl }}
{{- if (.Values.ozgcloud).impressumUrl }}
- name: ozgcloud_impressumUrl
value: {{ (.Values.ozgcloud).impressumUrl }}
{{- end }}
image: "{{ .Values.image.repo }}/{{ .Values.image.name }}:{{ coalesce (.Values.image).tag "latest" }}"
imagePullPolicy: Always
name: alfa
......
......@@ -237,3 +237,26 @@ tests:
asserts:
- failedTemplate:
errorMessage: ozgcloud.barrierefreiheitUrl muss angegeben sein
- it: should set impressumUrl
set:
ozgcloud:
barrierefreiheitUrl: http://barrierefreiheit.test.url
impressumUrl: http://impressum.test.url
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: ozgcloud_impressumUrl
value: http://impressum.test.url
- it: should not set impressumUrl
set:
ozgcloud:
barrierefreiheitUrl: http://barrierefreiheit.test.url
asserts:
- notContains:
path: spec.template.spec.containers[0].env
content:
name: ozgcloud_impressumUrl
any: true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment