2022-06-11 21:02:06 +00:00
|
|
|
package certificates
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2023-02-13 23:13:30 +00:00
|
|
|
"github.com/stretchr/testify/mock"
|
2023-02-11 02:29:08 +00:00
|
|
|
|
|
|
|
"codeberg.org/codeberg/pages/server/database"
|
2022-06-11 21:02:06 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestMockCert(t *testing.T) {
|
2023-02-13 23:13:30 +00:00
|
|
|
db := database.NewMockCertDB(t)
|
|
|
|
db.Mock.On("Put", mock.Anything, mock.Anything).Return(nil)
|
|
|
|
|
2023-02-10 03:00:14 +00:00
|
|
|
cert, err := mockCert("example.com", "some error msg", "codeberg.page", db)
|
|
|
|
assert.NoError(t, err)
|
2022-06-11 21:02:06 +00:00
|
|
|
if assert.NotEmpty(t, cert) {
|
|
|
|
assert.NotEmpty(t, cert.Certificate)
|
|
|
|
}
|
|
|
|
}
|