~chipaca/snappy/auth

« back to all changes in this revision

Viewing changes to pkg/lightweight/lightweight_test.go

  • Committer: John R. Lenton
  • Date: 2015-10-08 12:38:11 UTC
  • mfrom: (744.1.3 merged-list)
  • Revision ID: jlenton@gmail.com-20151008123811-j7levnlvgbnjh0xg
Merged merged-list into auth.

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
func (s *lightweightSuite) TestMapFmkNoPart(c *check.C) {
105
105
        bag := PartBagByName("fmk", "sideload")
106
106
        m := bag.Map(nil)
 
107
        c.Check(m["installed_size"], check.Matches, "[0-9]+")
 
108
        delete(m, "installed_size")
107
109
        c.Check(m, check.DeepEquals, map[string]string{
108
110
                "name":               "fmk",
109
111
                "origin":             "sideload",
112
114
                "icon":               filepath.Join(s.d, "apps", "fmk", "120", "icon.png"),
113
115
                "type":               "framework",
114
116
                "vendor":             "example.com",
115
 
                "installed_size":     "214", // this'll change :-/
116
117
                "download_size":      "-1",
117
118
                "description":        "",
118
119
                "rollback_available": "119",
151
152
        content, err := yaml.Marshal(snap)
152
153
        c.Assert(err, check.IsNil)
153
154
 
154
 
        p := snappy.ManifestPath(part)
 
155
        p := snappy.RemoteManifestPath(part)
155
156
        c.Assert(os.MkdirAll(filepath.Dir(p), 0755), check.IsNil)
156
157
        c.Assert(ioutil.WriteFile(p, content, 0644), check.IsNil)
157
158
 
174
175
func (s *lightweightSuite) TestMapAppNoPart(c *check.C) {
175
176
        bag := PartBagByName("foo", "bar")
176
177
        m := bag.Map(nil)
 
178
        c.Check(m["installed_size"], check.Matches, "[0-9]+")
 
179
        delete(m, "installed_size")
177
180
        c.Check(m, check.DeepEquals, map[string]string{
178
 
                "name":           "foo",
179
 
                "origin":         "bar",
180
 
                "status":         "active",
181
 
                "version":        "1.0",
182
 
                "icon":           filepath.Join(s.d, "apps", "foo.bar", "1.0", "icon.png"),
183
 
                "type":           "app",
184
 
                "vendor":         "example.com",
185
 
                "installed_size": "208", // this'll change :-/
186
 
                "download_size":  "-1",
187
 
                "description":    "",
 
181
                "name":          "foo",
 
182
                "origin":        "bar",
 
183
                "status":        "active",
 
184
                "version":       "1.0",
 
185
                "icon":          filepath.Join(s.d, "apps", "foo.bar", "1.0", "icon.png"),
 
186
                "type":          "app",
 
187
                "vendor":        "example.com",
 
188
                "download_size": "-1",
 
189
                "description":   "",
188
190
        })
189
191
}
190
192
 
201
203
 
202
204
        bag := PartBagByName("foo", "bar")
203
205
        m := bag.Map(part)
 
206
        c.Check(m["installed_size"], check.Matches, "[0-9]+")
 
207
        delete(m, "installed_size")
204
208
        c.Check(m, check.DeepEquals, map[string]string{
205
209
                "name":             "foo",
206
210
                "origin":           "bar",
209
213
                "icon":             filepath.Join(s.d, "apps", "foo.bar", "1.0", "icon.png"),
210
214
                "type":             "app",
211
215
                "vendor":           "example.com",
212
 
                "installed_size":   "208", // this'll change :-/
213
216
                "download_size":    "42",
214
217
                "description":      "",
215
218
                "update_available": "2",
264
267
func (s *lightweightSuite) TestMapInactiveOemNoPart(c *check.C) {
265
268
        bag := PartBagByName("oem", "canonical")
266
269
        m := bag.Map(nil)
 
270
        c.Check(m["installed_size"], check.Matches, "[0-9]+")
 
271
        delete(m, "installed_size")
267
272
        c.Check(m, check.DeepEquals, map[string]string{
268
 
                "name":           "oem",
269
 
                "origin":         "sideload", // best guess
270
 
                "status":         "installed",
271
 
                "version":        "3",
272
 
                "icon":           filepath.Join(s.d, "oem", "oem", "3", "icon.png"),
273
 
                "type":           "oem",
274
 
                "vendor":         "example.com",
275
 
                "installed_size": "206",
276
 
                "download_size":  "-1",
277
 
                "description":    "",
 
273
                "name":          "oem",
 
274
                "origin":        "sideload", // best guess
 
275
                "status":        "installed",
 
276
                "version":       "3",
 
277
                "icon":          filepath.Join(s.d, "oem", "oem", "3", "icon.png"),
 
278
                "type":          "oem",
 
279
                "vendor":        "example.com",
 
280
                "download_size": "-1",
 
281
                "description":   "",
278
282
        })
279
283
}
280
284