MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / TestDetokenizeIdentity_Empty

Function TestDetokenizeIdentity_Empty

identity_test.go:421–456  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

419}
420
421func TestDetokenizeIdentity_Empty(t *testing.T) {
422 datasource, mock, err := newTestDataSource()
423 if err != nil {
424 t.Fatalf("Error creating test data source: %s", err)
425 }
426
427 d, err := NewLedgerForge(datasource)
428 if err != nil {
429 t.Fatalf("Error creating LedgerForge instance: %s", err)
430 }
431
432 testID := "idt_123"
433
434 mock.ExpectBegin()
435 row := sqlmock.NewRows([]string{
436 "identity_id", "identity_type", "first_name", "last_name", "other_names", "gender", "dob",
437 "email_address", "phone_number", "nationality", "organization_name", "category",
438 "street", "country", "state", "post_code", "city", "created_at", "meta_data",
439 }).AddRow(
440 testID, "Individual", "John", "Doe", "Other", "Male", time.Now(),
441 "john@example.com", "1234567890", "US", "Org", "Cat",
442 "Street", "Country", "State", "12345", "City", time.Now(), `{}`,
443 )
444 mock.ExpectQuery("SELECT .* FROM ledgerforge.identity WHERE identity_id =").
445 WithArgs(testID).
446 WillReturnRows(row)
447 mock.ExpectCommit()
448
449 result, err := d.DetokenizeIdentity(testID)
450 assert.NoError(t, err)
451 assert.Empty(t, result)
452
453 if err := mock.ExpectationsWereMet(); err != nil {
454 t.Errorf("there were unfulfilled expectations: %s", err)
455 }
456}
457
458func TestTokenizeAllPII(t *testing.T) {
459 datasource, mock, err := newTestDataSource()

Callers

nothing calls this directly

Calls 3

DetokenizeIdentityMethod · 0.95
newTestDataSourceFunction · 0.85
NewLedgerForgeFunction · 0.85

Tested by

no test coverage detected