-
Notifications
You must be signed in to change notification settings - Fork 357
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: System settings endpoint returns expected Cache-Control header v… (
#15888) * fix: System settings endpoint returns expected Cache-Control header value [DHIS2-15196] * fix: Rename method to match Spring convention [DHIS2-15196]
- Loading branch information
1 parent
063fd2d
commit df7e1f5
Showing
3 changed files
with
33 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,7 @@ | |
|
||
import com.google.gson.JsonObject; | ||
import io.restassured.http.ContentType; | ||
import io.restassured.response.ValidatableResponse; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.hisp.dhis.ApiTest; | ||
import org.hisp.dhis.actions.LoginActions; | ||
|
@@ -41,12 +42,13 @@ | |
import org.hisp.dhis.helpers.QueryParamsBuilder; | ||
import org.hisp.dhis.helpers.TestCleanUp; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* @author David Katuscak <[email protected]> | ||
*/ | ||
public class SystemSettingsTests extends ApiTest { | ||
class SystemSettingsTests extends ApiTest { | ||
private static final String APPLICATION_INTRO_KEY = "keyApplicationIntro"; | ||
|
||
private static final String APPLICATION_FOOTER_KEY = "keyApplicationFooter"; | ||
|
@@ -69,8 +71,6 @@ public class SystemSettingsTests extends ApiTest { | |
|
||
private static final String FRENCH_INTRO = "French - Welcome to the DHIS2"; | ||
|
||
private LoginActions loginActions; | ||
|
||
private SystemSettingActions systemSettingActions; | ||
|
||
@BeforeEach | ||
|
@@ -79,7 +79,7 @@ public void setUp() { | |
|
||
systemSettingActions = new SystemSettingActions(); | ||
|
||
loginActions = new LoginActions(); | ||
LoginActions loginActions = new LoginActions(); | ||
loginActions.loginAsDefaultUser(); | ||
} | ||
|
||
|
@@ -115,7 +115,7 @@ private void prepareData() { | |
} | ||
|
||
@Test | ||
public void addSystemSetting() { | ||
void addSystemSetting() { | ||
String specificFooter = "Learn more at "; | ||
|
||
QueryParamsBuilder params = new QueryParamsBuilder(); | ||
|
@@ -129,7 +129,7 @@ public void addSystemSetting() { | |
} | ||
|
||
@Test | ||
public void returnDefaultValueWhenTranslationIsNotAvailable() { | ||
void returnDefaultValueWhenTranslationIsNotAvailable() { | ||
prepareData(); | ||
|
||
ApiResponse response = | ||
|
@@ -143,7 +143,7 @@ public void returnDefaultValueWhenTranslationIsNotAvailable() { | |
} | ||
|
||
@Test | ||
public void returnTranslationForUsersLocale() { | ||
void returnTranslationForUsersLocale() { | ||
prepareData(); | ||
|
||
ApiResponse response = | ||
|
@@ -157,7 +157,7 @@ public void returnTranslationForUsersLocale() { | |
} | ||
|
||
@Test | ||
public void returnTranslationForGivenLocale() { | ||
void returnTranslationForGivenLocale() { | ||
prepareData(); | ||
|
||
ApiResponse response = | ||
|
@@ -171,7 +171,7 @@ public void returnTranslationForGivenLocale() { | |
} | ||
|
||
@Test | ||
public void returnAllSystemSettings() { | ||
void returnAllSystemSettings() { | ||
prepareData(); | ||
|
||
ApiResponse response = systemSettingActions.get(); | ||
|
@@ -184,7 +184,7 @@ public void returnAllSystemSettings() { | |
} | ||
|
||
@Test | ||
public void deleteTranslationForGivenLocaleAndSettingKey() { | ||
void deleteTranslationForGivenLocaleAndSettingKey() { | ||
prepareData(); | ||
|
||
ApiResponse response = | ||
|
@@ -204,7 +204,7 @@ public void deleteTranslationForGivenLocaleAndSettingKey() { | |
} | ||
|
||
@Test | ||
public void deleteSystemSetting() { | ||
void deleteSystemSetting() { | ||
prepareData(); | ||
|
||
ApiResponse response = systemSettingActions.delete(APPLICATION_INTRO_KEY); | ||
|
@@ -224,7 +224,7 @@ public void deleteSystemSetting() { | |
} | ||
|
||
@Test | ||
public void getDefaultSystemSettingAsText() { | ||
void getDefaultSystemSettingAsText() { | ||
ApiResponse response = | ||
systemSettingActions.get( | ||
MAX_SYNC_ATTEMPTS_KEY, | ||
|
@@ -260,7 +260,7 @@ public void getDefaultSystemSettingAsText() { | |
} | ||
|
||
@Test | ||
public void getDefaultSystemSettingAsJson() { | ||
void getDefaultSystemSettingAsJson() { | ||
ApiResponse response = | ||
systemSettingActions.get( | ||
MAX_SYNC_ATTEMPTS_KEY, | ||
|
@@ -296,7 +296,7 @@ public void getDefaultSystemSettingAsJson() { | |
} | ||
|
||
@Test | ||
public void getDefaultSystemSettingWithNonSpecifiedContentTypeAndAccept() { | ||
void getDefaultSystemSettingWithNonSpecifiedContentTypeAndAccept() { | ||
ApiResponse response = | ||
systemSettingActions.get(MAX_SYNC_ATTEMPTS_KEY, "", "", new QueryParamsBuilder()); | ||
|
||
|
@@ -316,4 +316,13 @@ public void getDefaultSystemSettingWithNonSpecifiedContentTypeAndAccept() { | |
// ----------------------------------------- | ||
response = systemSettingActions.get(EMAIL_SENDER_KEY, "", "", new QueryParamsBuilder()); | ||
} | ||
|
||
@Test | ||
@DisplayName( | ||
"A call to the system settings endpoint returns expected cache control header values") | ||
void getSystemSettingsCheckCacheControl() { | ||
ValidatableResponse validate = systemSettingActions.get().validate(); | ||
validate.statusCode(200); | ||
validate.header("Cache-Control", "no-cache, no-store, must-revalidate"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters