feat(assessment): assign the demonstration category and keep result history
This commit is contained in:
1 parent
b3c6dc870b
commit
8277133712
61 files changed
+4338
-268
No files matched your search
@@ -491,6 +491,18 @@ type assessmentAttemptHTTPHarness struct {
|
||||
}
|
||||
|
||||
func newAssessmentAttemptHTTPHarness(ctx context.Context, t *testing.T, env *testEnvironment) *assessmentAttemptHTTPHarness {
|
||||
t.Helper()
|
||||
return newAssessmentAttemptHTTPHarnessWithCategories(ctx, t, env, assessment.AssessmentCategoryDecisionSettings{})
|
||||
}
|
||||
|
||||
// newAssessmentAttemptHTTPHarnessWithCategories builds the attempt router with
|
||||
// explicit category assignment settings. The zero settings deny assignment.
|
||||
func newAssessmentAttemptHTTPHarnessWithCategories(
|
||||
ctx context.Context,
|
||||
t *testing.T,
|
||||
env *testEnvironment,
|
||||
categories assessment.AssessmentCategoryDecisionSettings,
|
||||
) *assessmentAttemptHTTPHarness {
|
||||
t.Helper()
|
||||
pool := env.newPool(ctx, t)
|
||||
store := postgresadapter.NewIdentityStore(pool)
|
||||
@@ -521,9 +533,9 @@ func newAssessmentAttemptHTTPHarness(ctx context.Context, t *testing.T, env *tes
|
||||
)
|
||||
questionnaireHandler := v1.NewQuestionnaireHandler(questionnaireusecase.NewService(transactor, clock.Now))
|
||||
catalogHandler := v1.NewCatalogHandler(assessment.NewBank(transactor))
|
||||
attemptService, err := assessment.NewAttemptService(transactor, transactor, keyring, clock.Now)
|
||||
attemptService, err := assessment.NewAttemptServiceWithCategorySettings(transactor, transactor, keyring, clock.Now, categories)
|
||||
if err != nil {
|
||||
t.Fatalf("NewAttemptService() error = %v", err)
|
||||
t.Fatalf("NewAttemptServiceWithCategorySettings() error = %v", err)
|
||||
}
|
||||
signalObserver, err := assessment.NewSignalObserver(keyring)
|
||||
if err != nil {
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -353,6 +353,10 @@ func TestOrganizationNeedsStorage(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
// needCreationResultMigrationVersion is the migration that creates
|
||||
// organization_need_creation_results.
|
||||
const needCreationResultMigrationVersion = 26
|
||||
|
||||
func TestNeedCreationResultMigrationRollbackPreflight(t *testing.T) {
|
||||
env := bootstrap(t, postgresService)
|
||||
ctx, cancel := context.WithTimeout(t.Context(), organizationTestTimeout)
|
||||
@@ -362,6 +366,10 @@ func TestNeedCreationResultMigrationRollbackPreflight(t *testing.T) {
|
||||
if _, err := migrator.Up(ctx); err != nil {
|
||||
t.Fatalf("apply migrations to rollback test database: %v", err)
|
||||
}
|
||||
// The preflight belongs to the migration that created the replay table, so
|
||||
// the migrations added after it are rolled back first. The database holds
|
||||
// no data yet, which keeps their own guarded rollbacks out of this test.
|
||||
rollBackAboveMigration(ctx, t, migrator, needCreationResultMigrationVersion)
|
||||
pool := newPoolFor(ctx, t, databaseURL)
|
||||
now := time.Now().UTC().Truncate(time.Microsecond)
|
||||
fixture := organizationFixture{
|
||||
|
||||
@@ -49,7 +49,7 @@ var (
|
||||
{"candidate_questionnaire_specializations"}, {"candidate_questionnaires"},
|
||||
}
|
||||
assessmentAttemptTables = []pgx.Identifier{
|
||||
{"assessment_attempt_results"},
|
||||
{"candidate_assessment_categories"}, {"assessment_attempt_results"},
|
||||
{"assessment_signal_idempotency_outcomes"}, {"assessment_signal_events"}, {"assessment_signal_batches"},
|
||||
{"assessment_answer_observations"}, {"assessment_attempt_origin_marks"}, {"assessment_attempt_reviews"},
|
||||
{"assessment_attempt_items"}, {"assessment_attempts"}, {"assessment_attempt_idempotency_outcomes"},
|
||||
@@ -57,10 +57,15 @@ var (
|
||||
supportCaseTables = []pgx.Identifier{
|
||||
{"support_case_events"}, {"support_cases"}, {"support_case_create_outcomes"}, {"support_case_request_events"},
|
||||
}
|
||||
// userNoticeTables hold per-user notices that refer to users and, for the
|
||||
// inbox, to organizations.
|
||||
userNoticeTables = []pgx.Identifier{
|
||||
{"assessment_signal_notice_acknowledgements"}, {"notification_inbox_events"},
|
||||
}
|
||||
// usersDependentTables is every table that references users, directly or
|
||||
// through another table of the list. A TRUNCATE of users must name all of
|
||||
// them, so a migration that adds such a table adds it here.
|
||||
usersDependentTables = slices.Concat(identityTables, deliveryTables, consentTables, organizationTables, candidateProfileTables, candidateQuestionnaireTables, candidatePrivacyTables, assessmentAttemptTables, supportCaseTables)
|
||||
usersDependentTables = slices.Concat(identityTables, deliveryTables, consentTables, organizationTables, candidateProfileTables, candidateQuestionnaireTables, candidatePrivacyTables, assessmentAttemptTables, supportCaseTables, userNoticeTables)
|
||||
)
|
||||
|
||||
// organizationFixture works on the bootstrap database. The tables are
|
||||
|
||||
@@ -249,7 +249,8 @@ func TestPolicyVersions(t *testing.T) {
|
||||
assessment_training_bank_binding_families, assessment_attempts, assessment_attempt_items,
|
||||
support_cases, support_case_events, assessment_signal_idempotency_outcomes,
|
||||
assessment_signal_events, assessment_signal_batches, assessment_attempt_results,
|
||||
assessment_attempt_reviews, assessment_answer_observations, assessment_attempt_origin_marks`},
|
||||
assessment_attempt_reviews, assessment_answer_observations, assessment_attempt_origin_marks,
|
||||
assessment_synthetic_category_reviews, candidate_assessment_categories`},
|
||||
}
|
||||
for _, statement := range statements {
|
||||
_, err := fixture.pool.Exec(ctx, statement.sql, statement.args...)
|
||||
|
||||
Reference in new issue
Block a user