From 196cd88b1c7c44a337ca12f6a804f1bb7fa83c4a Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Tue, 14 Mar 2023 17:11:04 +0100 Subject: [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 --- internal/db/bundb/instance_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'internal/db/bundb/instance_test.go') diff --git a/internal/db/bundb/instance_test.go b/internal/db/bundb/instance_test.go index 3edb68370..4269df5ca 100644 --- a/internal/db/bundb/instance_test.go +++ b/internal/db/bundb/instance_test.go @@ -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) -- cgit v1.2.3