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

Method BeforeTest

api/plugin_test.go:38–62  ·  view source on GitHub ↗
(suiteName, testName string)

Source from the content-addressed store, hash-verified

36}
37
38func (s *PluginSuite) BeforeTest(suiteName, testName string) {
39 mode.Set(mode.TestDev)
40 s.db = testdb.NewDB(s.T())
41 s.resetRecorder()
42 manager, err := plugin.NewManager(s.db, "", nil, s)
43 assert.Nil(s.T(), err)
44 s.manager = manager
45 withURL(s.ctx, "http", "example.com")
46 s.a = &PluginAPI{DB: s.db, Manager: manager, Notifier: s}
47
48 mockPluginCompat := new(mock.Plugin)
49 assert.Nil(s.T(), s.manager.LoadPlugin(mockPluginCompat))
50
51 s.db.User(1)
52 assert.Nil(s.T(), s.manager.InitializeForUserID(1))
53 s.db.User(2)
54 assert.Nil(s.T(), s.manager.InitializeForUserID(2))
55
56 s.db.CreatePluginConf(&model.PluginConf{
57 UserID: 1,
58 ModulePath: "github.com/gotify/server/v2/plugin/example/removed",
59 Token: "P1234",
60 Enabled: false,
61 })
62}
63
64func (s *PluginSuite) getDanglingConf(uid uint) *model.PluginConf {
65 conf, err := s.db.GetPluginConfByUserAndPath(uid, "github.com/gotify/server/v2/plugin/example/removed")

Callers

nothing calls this directly

Calls 9

resetRecorderMethod · 0.95
SetFunction · 0.92
NewDBFunction · 0.92
NewManagerFunction · 0.92
LoadPluginMethod · 0.80
UserMethod · 0.80
InitializeForUserIDMethod · 0.80
withURLFunction · 0.70
CreatePluginConfMethod · 0.65

Tested by

no test coverage detected