mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 12:12:24 -06:00
[feature] Application creation + management via API + settings panel (#3906)
* [feature] Application creation + management via API + settings panel * fix docs links * add errnorows test * use known application as shorter * add comment about side effects
This commit is contained in:
parent
d3c3d34aae
commit
d5847e2d2b
61 changed files with 3036 additions and 252 deletions
|
|
@ -92,7 +92,7 @@ func (suite *ApplicationTestSuite) TestDeleteApplicationBy() {
|
|||
for _, app := range suite.testApplications {
|
||||
for lookup, dbfunc := range map[string]func() error{
|
||||
"client_id": func() error {
|
||||
return suite.db.DeleteApplicationByClientID(ctx, app.ClientID)
|
||||
return suite.db.DeleteApplicationByID(ctx, app.ID)
|
||||
},
|
||||
} {
|
||||
// Clear database caches.
|
||||
|
|
@ -124,6 +124,36 @@ func (suite *ApplicationTestSuite) TestGetAllTokens() {
|
|||
suite.NotEmpty(tokens)
|
||||
}
|
||||
|
||||
func (suite *ApplicationTestSuite) TestDeleteTokensByClientID() {
|
||||
ctx := context.Background()
|
||||
|
||||
// Delete tokens by each app.
|
||||
for _, app := range suite.testApplications {
|
||||
if err := suite.state.DB.DeleteTokensByClientID(ctx, app.ClientID); err != nil {
|
||||
suite.FailNow(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure all tokens deleted.
|
||||
for _, token := range suite.testTokens {
|
||||
_, err := suite.db.GetTokenByID(ctx, token.ID)
|
||||
if !errors.Is(err, db.ErrNoEntries) {
|
||||
suite.FailNow("", "token %s not deleted", token.ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *ApplicationTestSuite) TestDeleteTokensByUnknownClientID() {
|
||||
// Should not return ErrNoRows even though
|
||||
// the client with given ID doesn't exist.
|
||||
if err := suite.state.DB.DeleteTokensByClientID(
|
||||
context.Background(),
|
||||
"01JPJ4NCGH6GHY7ZVYBHNP55XS",
|
||||
); err != nil {
|
||||
suite.FailNow(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplicationTestSuite(t *testing.T) {
|
||||
suite.Run(t, new(ApplicationTestSuite))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue