summaryrefslogtreecommitdiff
path: root/internal/db/bundb/basic_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-09-10 14:36:10 +0200
committerLibravatar GitHub <noreply@github.com>2021-09-10 14:36:10 +0200
commite681aac5899b4a93d7c71e9a334a67c3f2b00e93 (patch)
tree748a916a058dff03e42e5aebbfa7f98f8f6288ad /internal/db/bundb/basic_test.go
parentremove boosted statuses from public (federated timeline) (#201) (diff)
downloadgotosocial-e681aac5899b4a93d7c71e9a334a67c3f2b00e93.tar.xz
fixes + db changes (#204)
* fixes + db changes * make duration more lenient
Diffstat (limited to 'internal/db/bundb/basic_test.go')
-rw-r--r--internal/db/bundb/basic_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/db/bundb/basic_test.go b/internal/db/bundb/basic_test.go
index e5f7e159a..acdfb6640 100644
--- a/internal/db/bundb/basic_test.go
+++ b/internal/db/bundb/basic_test.go
@@ -64,6 +64,40 @@ func (suite *BasicTestSuite) TestGetAllNotNull() {
}
}
+func (suite *BasicTestSuite) TestUpdateOneByPrimaryKeySetEmpty() {
+ testAccount := suite.testAccounts["local_account_1"]
+
+ // try removing the note from zork
+ err := suite.db.UpdateOneByPrimaryKey(context.Background(), "note", "", testAccount)
+ suite.NoError(err)
+
+ // get zork out of the database
+ dbAccount, err := suite.db.GetAccountByID(context.Background(), testAccount.ID)
+ suite.NoError(err)
+ suite.NotNil(dbAccount)
+
+ // note should be empty now
+ suite.Empty(dbAccount.Note)
+}
+
+func (suite *BasicTestSuite) TestUpdateOneByPrimaryKeySetValue() {
+ testAccount := suite.testAccounts["local_account_1"]
+
+ note := "this is my new note :)"
+
+ // try updating the note on zork
+ err := suite.db.UpdateOneByPrimaryKey(context.Background(), "note", note, testAccount)
+ suite.NoError(err)
+
+ // get zork out of the database
+ dbAccount, err := suite.db.GetAccountByID(context.Background(), testAccount.ID)
+ suite.NoError(err)
+ suite.NotNil(dbAccount)
+
+ // note should be set now
+ suite.Equal(note, dbAccount.Note)
+}
+
func TestBasicTestSuite(t *testing.T) {
suite.Run(t, new(BasicTestSuite))
}