github.com/mundipagg/boleto-api@v0.0.0-20230620145841-3f9ec742599f/app/app_test.go (about)

     1  //go:build integration || !unit
     2  // +build integration !unit
     3  
     4  package app
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/mundipagg/boleto-api/certificate"
    10  	"github.com/mundipagg/boleto-api/config"
    11  	"github.com/mundipagg/boleto-api/mock"
    12  	"github.com/stretchr/testify/assert"
    13  )
    14  
    15  func Test_installCertificates(t *testing.T) {
    16  	mock.StartMockService("9002")
    17  
    18  	tests := []struct {
    19  		name        string
    20  		certificate string
    21  	}{
    22  		{
    23  			name:        "Fetch sk OpenBank from localStorage successfully",
    24  			certificate: config.Get().AzureStorageOpenBankSkName,
    25  		},
    26  		{
    27  			name:        "Fetch JPMorganPk from localStorage successfully",
    28  			certificate: config.Get().AzureStorageJPMorganPkName,
    29  		},
    30  		{
    31  			name:        "Fetch JPMorganCrt from localStorage successfully",
    32  			certificate: config.Get().AzureStorageJPMorganCrtName,
    33  		},
    34  		{
    35  			name:        "Fetch JPMorganSignCrt from localStorage successfully",
    36  			certificate: config.Get().AzureStorageJPMorganSignCrtName,
    37  		},
    38  	}
    39  	for _, tt := range tests {
    40  		t.Run(tt.name, func(t *testing.T) {
    41  			installCertificates()
    42  		})
    43  		sk, err := certificate.GetCertificateFromStore(tt.certificate)
    44  		assert.Nil(t, err)
    45  		assert.NotNil(t, sk)
    46  	}
    47  }