@@ -6920,23 +6920,34 @@ public void testExcludeEmailOverride() {
69206920 // Publish Dataset
69216921 UtilIT .publishDatasetViaNativeApi (datasetId , "major" , apiToken ).prettyPrint ();
69226922
6923+ // Setting is not set - datasetContactEmail will NOT be excluded
6924+ Response response = UtilIT .getDatasetVersion (datasetPid , DS_VERSION_LATEST_PUBLISHED , apiToken );
6925+ response .then ().assertThat ().statusCode (OK .getStatusCode ());
6926+ String json = response .prettyPrint ();
6927+ assertTrue (json .contains ("datasetContactName" ));
6928+ assertTrue (json .contains ("datasetContactEmail" ));
6929+
69236930 UtilIT .setSetting (SettingsServiceBean .Key .ExcludeEmailFromExport , "true" );
6924- // User has permission to ignore the setting allowing the datasetContactEmail to be included in the response
6925- Response response = UtilIT .getDatasetVersion (datasetPid , DS_VERSION_LATEST_PUBLISHED , apiToken , true , false , false , true );
6926- //response.prettyPrint();
6927- response .then ().assertThat ()
6928- .statusCode (OK .getStatusCode ());
69296931
6930- String json = response .prettyPrint ();
6932+ // User does not ignore the setting - datasetContactEmail will be excluded
6933+ response = UtilIT .getDatasetVersion (datasetPid , DS_VERSION_LATEST_PUBLISHED , apiToken );
6934+ response .then ().assertThat ().statusCode (OK .getStatusCode ());
6935+ json = response .prettyPrint ();
6936+ assertTrue (json .contains ("datasetContactName" ));
6937+ assertTrue (!json .contains ("datasetContactEmail" ));
6938+
6939+ // User has permission to ignore the setting allowing the datasetContactEmail to be included in the response
6940+ response = UtilIT .getDatasetVersion (datasetPid , DS_VERSION_LATEST_PUBLISHED , apiToken , true , false , false , true );
6941+ response .then ().assertThat ().statusCode (OK .getStatusCode ());
6942+ json = response .prettyPrint ();
6943+ assertTrue (json .contains ("datasetContactName" ));
69316944 assertTrue (json .contains ("datasetContactEmail" ));
69326945
6933- // User has no permission to override the setting. datasetContactEmail will be excluded
6946+ // User has no permission to override the setting - datasetContactEmail will be excluded
69346947 response = UtilIT .getDatasetVersion (datasetPid , DS_VERSION_LATEST_PUBLISHED , apiTokenNoPerms , true , false , false , true );
6935- //response.prettyPrint();
6936- response .then ().assertThat ()
6937- .statusCode (OK .getStatusCode ());
6938-
6948+ response .then ().assertThat ().statusCode (OK .getStatusCode ());
69396949 json = response .prettyPrint ();
6950+ assertTrue (json .contains ("datasetContactName" ));
69406951 assertTrue (!json .contains ("datasetContactEmail" ));
69416952 }
69426953
0 commit comments