MCPcopy
hub / github.com/gotify/server / BeforeTest

Method BeforeTest

api/user_test.go:35–52  ·  view source on GitHub ↗
(suiteName, testName string)

Source from the content-addressed store, hash-verified

33}
34
35func (s *UserSuite) BeforeTest(suiteName, testName string) {
36 mode.Set(mode.TestDev)
37 s.recorder = httptest.NewRecorder()
38 s.ctx, _ = gin.CreateTestContext(s.recorder)
39
40 s.db = testdb.NewDB(s.T())
41
42 s.notifier = new(UserChangeNotifier)
43 s.notifier.OnUserDeleted(func(uint) error {
44 s.notifiedDelete = true
45 return nil
46 })
47 s.notifier.OnUserAdded(func(uint) error {
48 s.notifiedAdd = true
49 return nil
50 })
51 s.a = &UserAPI{DB: s.db, UserChangeNotifier: s.notifier}
52}
53
54func (s *UserSuite) AfterTest(suiteName, testName string) {
55 s.db.Close()

Callers

nothing calls this directly

Calls 4

SetFunction · 0.92
NewDBFunction · 0.92
OnUserDeletedMethod · 0.80
OnUserAddedMethod · 0.80

Tested by

no test coverage detected