def test_filenames_to_streams(self):
     with self.filenames_to_streams_cxt() as (item, item2, file_a, file_b,
                                              out_d, stream_dir):
         filenames_to_streams([file_a.name, file_b.name], self.updated,
                              out_d)
         content = load_stream_dir(stream_dir)
     self.assertEqual(
         sorted(content.keys()),
         sorted(['index.json', 'foo:1.json']))
     items = [dict_to_item(item), dict_to_item(item2)]
     trees = items2content_trees(items, {
         'updated': self.updated, 'datatype': 'content-download'})
     expected = generate_index(trees, 'updated', FileNamer)
     self.assertEqual(expected, content['index.json'])
     self.assertEqual(trees['foo:1'], content['foo:1.json'])
 def test_no_size(self):
     pedigree = {
         'content_id': 'cid', 'product_name': 'pname',
         'version_name': 'vname', 'item_name': 'iname',
         }
     item_dict = {}
     item_dict.update(pedigree)
     item = dict_to_item(item_dict)
     self.assertEqual(Item(data={}, **pedigree), item)
Ejemplo n.º 3
0
 def insert_item(self, data, src, target, pedigree, contentsource):
     data = util.products_exdata(src, pedigree)
     self.items.append(dict_to_item(data))
Ejemplo n.º 4
0
 def insert_item(self, data, src, target, pedigree, contentsource):
     data = util.products_exdata(src, pedigree)
     self.items.append(dict_to_item(data))