summaryrefslogtreecommitdiff
path: root/internal/db/bundb/report_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2023-01-23 13:14:21 +0100
committerLibravatar GitHub <noreply@github.com>2023-01-23 13:14:21 +0100
commite9747247d58a0423d5e40fda5c5b37b4b4526495 (patch)
tree5574b05f1dec1ad88c49b9891f1e54719f1b9eb1 /internal/db/bundb/report_test.go
parent[chore] bump go version to 1.19.5 (#1377) (diff)
downloadgotosocial-e9747247d58a0423d5e40fda5c5b37b4b4526495.tar.xz
[feature] Implement `/api/v1/reports` endpoints on client API (#1330)
* start adding report client api * route + test reports get * start report create endpoint * you can create reports now babyy * stub account report processor * add single reportGet endpoint * fix test * add more filtering params to /api/v1/reports GET * update swagger * use marshalIndent in tests * add + test missing Link info
Diffstat (limited to 'internal/db/bundb/report_test.go')
-rw-r--r--internal/db/bundb/report_test.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/db/bundb/report_test.go b/internal/db/bundb/report_test.go
index 85bc4b36f..27e4e758c 100644
--- a/internal/db/bundb/report_test.go
+++ b/internal/db/bundb/report_test.go
@@ -60,6 +60,22 @@ func (suite *ReportTestSuite) TestGetReportByURI() {
suite.NotEmpty(report.URI)
}
+func (suite *ReportTestSuite) TestGetAllReports() {
+ reports, err := suite.db.GetReports(context.Background(), nil, "", "", "", "", "", 0)
+ suite.NoError(err)
+ suite.NotEmpty(reports)
+}
+
+func (suite *ReportTestSuite) TestGetAllReportsByAccountID() {
+ accountID := suite.testAccounts["local_account_2"].ID
+ reports, err := suite.db.GetReports(context.Background(), nil, accountID, "", "", "", "", 0)
+ suite.NoError(err)
+ suite.NotEmpty(reports)
+ for _, r := range reports {
+ suite.Equal(accountID, r.AccountID)
+ }
+}
+
func (suite *ReportTestSuite) TestPutReport() {
ctx := context.Background()