[feature] Allow admins to send test emails (#1620)

* [feature] Allow admins to send test emails

* implement unwrap on new error type

* add + use gtserror types

* GoToSocial Email Test -> GoToSocial Test Email

* add + use getInstance db call

* removed unused "unknown" error type
This commit is contained in:
tobi
2023-03-14 17:11:04 +01:00
committed by GitHub
parent d5529d6c9f
commit 196cd88b1c
17 changed files with 460 additions and 83 deletions

View File

@@ -23,6 +23,7 @@ import (
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db"
)
type InstanceTestSuite struct {
@@ -59,6 +60,18 @@ func (suite *InstanceTestSuite) TestCountInstanceDomains() {
suite.Equal(2, count)
}
func (suite *InstanceTestSuite) TestGetInstanceOK() {
instance, err := suite.db.GetInstance(context.Background(), "localhost:8080")
suite.NoError(err)
suite.NotNil(instance)
}
func (suite *InstanceTestSuite) TestGetInstanceNonexistent() {
instance, err := suite.db.GetInstance(context.Background(), "doesnt.exist.com")
suite.ErrorIs(err, db.ErrNoEntries)
suite.Nil(instance)
}
func (suite *InstanceTestSuite) TestGetInstancePeers() {
peers, err := suite.db.GetInstancePeers(context.Background(), false)
suite.NoError(err)