summaryrefslogtreecommitdiff
path: root/internal/db/bundb/domain_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-10-06 12:48:17 +0200
committerLibravatar GitHub <noreply@github.com>2022-10-06 12:48:17 +0200
commit5cf0f9950a95cf46fda6ba8f479aa4728eba5ec4 (patch)
tree560428ae18c9f9890e4195da1abcbd76401d3a1c /internal/db/bundb/domain_test.go
parent[feature] Add emoji image size to instance response (#892) (diff)
downloadgotosocial-5cf0f9950a95cf46fda6ba8f479aa4728eba5ec4.tar.xz
[bugfix] Fix new domain block date (#893)
Diffstat (limited to 'internal/db/bundb/domain_test.go')
-rw-r--r--internal/db/bundb/domain_test.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/internal/db/bundb/domain_test.go b/internal/db/bundb/domain_test.go
index 48c4a7798..41a73ff80 100644
--- a/internal/db/bundb/domain_test.go
+++ b/internal/db/bundb/domain_test.go
@@ -34,13 +34,9 @@ type DomainTestSuite struct {
func (suite *DomainTestSuite) TestIsDomainBlocked() {
ctx := context.Background()
- now := time.Now()
-
domainBlock := &gtsmodel.DomainBlock{
ID: "01G204214Y9TNJEBX39C7G88SW",
Domain: "some.bad.apples",
- CreatedAt: now,
- UpdatedAt: now,
CreatedByAccountID: suite.testAccounts["admin_account"].ID,
CreatedByAccount: suite.testAccounts["admin_account"],
}
@@ -50,13 +46,14 @@ func (suite *DomainTestSuite) TestIsDomainBlocked() {
suite.NoError(err)
suite.False(blocked)
- err = suite.db.CreateDomainBlock(ctx, *domainBlock)
+ err = suite.db.CreateDomainBlock(ctx, domainBlock)
suite.NoError(err)
// domain block now exists
blocked, err = suite.db.IsDomainBlocked(ctx, domainBlock.Domain)
suite.NoError(err)
suite.True(blocked)
+ suite.WithinDuration(time.Now(), domainBlock.CreatedAt, 10*time.Second)
}
func (suite *DomainTestSuite) TestIsDomainBlockedNonASCII() {
@@ -82,7 +79,7 @@ func (suite *DomainTestSuite) TestIsDomainBlockedNonASCII() {
suite.NoError(err)
suite.False(blocked)
- err = suite.db.CreateDomainBlock(ctx, *domainBlock)
+ err = suite.db.CreateDomainBlock(ctx, domainBlock)
suite.NoError(err)
// domain block now exists
@@ -118,7 +115,7 @@ func (suite *DomainTestSuite) TestIsDomainBlockedNonASCII2() {
suite.NoError(err)
suite.False(blocked)
- err = suite.db.CreateDomainBlock(ctx, *domainBlock)
+ err = suite.db.CreateDomainBlock(ctx, domainBlock)
suite.NoError(err)
// domain block now exists