Merge remote-tracking branch 'origin/feature/CTLE-421-migrate-to-use-api-keys' into integration/sprint-25

This commit is contained in:
2023-05-01 20:00:16 -05:00
20 changed files with 413 additions and 20 deletions

View File

@ -22,6 +22,7 @@
package com.kingsrook.qqq.backend.core.actions.tables;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import com.kingsrook.qqq.backend.core.BaseTest;
@ -33,6 +34,7 @@ import com.kingsrook.qqq.backend.core.model.actions.tables.query.QQueryFilter;
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QueryInput;
import com.kingsrook.qqq.backend.core.model.actions.tables.query.QueryOutput;
import com.kingsrook.qqq.backend.core.model.data.QRecord;
import com.kingsrook.qqq.backend.core.modules.backend.implementations.mock.MockQueryAction;
import com.kingsrook.qqq.backend.core.utils.CollectionUtils;
import com.kingsrook.qqq.backend.core.utils.TestUtils;
import org.junit.jupiter.api.Test;
@ -73,17 +75,40 @@ class QueryActionTest extends BaseTest
// this SHOULD be empty, based on the default for the should //
///////////////////////////////////////////////////////////////
assertThat(record.getDisplayValues()).isEmpty();
//////////////////////////////////////////
// hidden field should not be in record //
//////////////////////////////////////////
assertThat(record.getValue("superSecret")).isNull();
/////////////////////////////////////
// password field should be masked //
/////////////////////////////////////
assertThat(record.getValueString("ssn")).contains("****");
}
////////////////////////////////////
// now flip that field and re-run //
////////////////////////////////////
////////////////////////////////////////////////////////
// now flip some fields, re-run, and validate results //
////////////////////////////////////////////////////////
queryInput.setShouldGenerateDisplayValues(true);
queryInput.setShouldMaskPasswords(false);
queryInput.setShouldOmitHiddenFields(false);
assertThat(queryOutput.getRecords()).isNotEmpty();
queryOutput = new QueryAction().execute(queryInput);
for(QRecord record : queryOutput.getRecords())
{
assertThat(record.getDisplayValues()).isNotEmpty();
//////////////////////////////////////////
// hidden field should now be in record //
//////////////////////////////////////////
assertThat(record.getValue("superSecret")).isNotNull();
/////////////////////////////////////
// password field should be masked //
/////////////////////////////////////
Serializable mockValue = MockQueryAction.getMockValue(QContext.getQInstance().getTable("person"), "ssn");
assertThat(record.getValueString("ssn")).isEqualTo(mockValue);
}
}

View File

@ -528,7 +528,8 @@ public class TestUtils
.withField(new QFieldMetaData("noOfShoes", QFieldType.INTEGER).withDisplayFormat(DisplayFormat.COMMAS))
.withField(new QFieldMetaData("cost", QFieldType.DECIMAL).withDisplayFormat(DisplayFormat.CURRENCY))
.withField(new QFieldMetaData("price", QFieldType.DECIMAL).withDisplayFormat(DisplayFormat.CURRENCY))
;
.withField(new QFieldMetaData("ssn", QFieldType.STRING).withType(QFieldType.PASSWORD))
.withField(new QFieldMetaData("superSecret", QFieldType.STRING).withType(QFieldType.PASSWORD).withIsHidden(true));
}