()
| 38 | ) |
| 39 | |
| 40 | func newTestDataSource() (database.IDataSource, sqlmock.Sqlmock, error) { |
| 41 | cnf := &config.Configuration{ |
| 42 | Redis: config.RedisConfig{ |
| 43 | Dns: testRedisAddr(), |
| 44 | }, |
| 45 | Queue: config.QueueConfig{ |
| 46 | WebhookQueue: "webhook_queue", |
| 47 | TransactionQueue: "transaction_queue", |
| 48 | IndexQueue: "index_queue", |
| 49 | NumberOfQueues: 1, |
| 50 | }, |
| 51 | Server: config.ServerConfig{SecretKey: "some-secret"}, |
| 52 | TokenizationSecret: "12345678901234567890123456789012", |
| 53 | AccountNumberGeneration: config.AccountNumberGenerationConfig{ |
| 54 | HttpService: config.AccountGenerationHttpService{ |
| 55 | Url: "http://example.com/generateAccount", |
| 56 | }, |
| 57 | }, |
| 58 | } |
| 59 | |
| 60 | config.ConfigStore.Store(cnf) |
| 61 | db, mock, err := sqlmock.New() |
| 62 | if err != nil { |
| 63 | log.Printf("an error '%s' was not expected when opening a stub database Connection", err) |
| 64 | } |
| 65 | newCache := cache.NewCacheWithClient(redis.NewClient(&redis.Options{Addr: testRedisAddr()})) |
| 66 | return &database.Datasource{Conn: db, Cache: newCache}, mock, nil |
| 67 | } |
| 68 | |
| 69 | func TestCreateLedger(t *testing.T) { |
| 70 | datasource, mock, err := newTestDataSource() |
no test coverage detected