MCPcopy Create free account
hub / github.com/aptly-dev/aptly / SetUpTest

Method SetUpTest

api/files_test.go:32–61  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

30var _ = Suite(&FilesUploadDiskFullSuite{})
31
32func (s *FilesUploadDiskFullSuite) SetUpTest(c *C) {
33 aptly.Version = "testVersion"
34
35 file, err := os.CreateTemp("", "aptly")
36 c.Assert(err, IsNil)
37 s.configFile = file
38
39 jsonString, err := json.Marshal(gin.H{
40 "architectures": []string{},
41 "rootDir": c.MkDir(),
42 })
43 c.Assert(err, IsNil)
44 _, err = file.Write(jsonString)
45 c.Assert(err, IsNil)
46 _ = file.Close()
47
48 flags := flag.NewFlagSet("fakeFlags", flag.ContinueOnError)
49 flags.Bool("no-lock", false, "dummy")
50 flags.Int("db-open-attempts", 3, "dummy")
51 flags.String("config", s.configFile.Name(), "dummy")
52 flags.String("architectures", "", "dummy")
53 s.flags = flags
54
55 aptlyContext, err := ctx.NewContext(s.flags)
56 c.Assert(err, IsNil)
57
58 s.aptlyContext = aptlyContext
59 s.router = Router(aptlyContext)
60 context = aptlyContext
61}
62
63func (s *FilesUploadDiskFullSuite) TearDownTest(c *C) {
64 if s.configFile != nil {

Callers

nothing calls this directly

Calls 5

RouterFunction · 0.85
MkDirMethod · 0.65
WriteMethod · 0.65
CloseMethod · 0.65
StringMethod · 0.65

Tested by

no test coverage detected