This commit is contained in:
@@ -23,6 +23,28 @@ func (r *serviceRepository) RetryByOperator(_ context.Context, id, actor, reason
|
||||
return ledger.Settlement{ID: id, Status: ledger.SettlementRetryable}, nil
|
||||
}
|
||||
|
||||
func (r *serviceRepository) IgnoreByOperator(_ context.Context, id, actor, reason string) (ledger.Settlement, error) {
|
||||
r.retriedID, r.actor, r.reason = id, actor, reason
|
||||
return ledger.Settlement{ID: id, Status: ledger.SettlementIgnored}, nil
|
||||
}
|
||||
|
||||
func TestIgnoreByOperatorRequiresReviewedAuditIdentity(t *testing.T) {
|
||||
repository := &serviceRepository{}
|
||||
service := NewService(repository)
|
||||
for _, reason := range []string{"", " "} {
|
||||
if _, err := service.IgnoreByOperator(context.Background(), "id", "actor", reason); err == nil {
|
||||
t.Fatal("expected blank review reason to be rejected")
|
||||
}
|
||||
}
|
||||
if repository.retriedID != "" {
|
||||
t.Fatal("invalid dismissal reached repository")
|
||||
}
|
||||
got, err := service.IgnoreByOperator(context.Background(), "id", "actor-7", " cannot complete ")
|
||||
if err != nil || got.Status != ledger.SettlementIgnored || repository.actor != "actor-7" || repository.reason != "cannot complete" {
|
||||
t.Fatalf("unexpected dismissal: %+v repo=%+v err=%v", got, repository, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRetryByOperatorRequiresCompleteAuditIdentity(t *testing.T) {
|
||||
service := NewService(&serviceRepository{})
|
||||
if _, err := service.RetryByOperator(context.Background(), "id", "actor", ""); err == nil {
|
||||
|
||||
Reference in New Issue
Block a user