1#!/usr/bin/env python
2# Copyright (c) 2012 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6import os
7import sys
8import unittest
9
10from caching_file_system import CachingFileSystem
11from compiled_file_system import CompiledFileSystem
12from example_zipper import ExampleZipper
13from local_file_system import LocalFileSystem
14from object_store_creator import ObjectStoreCreator
15
16class ExampleZipperTest(unittest.TestCase):
17  def setUp(self):
18    object_store_creator = ObjectStoreCreator.ForTest()
19    self._file_system = CachingFileSystem(
20        LocalFileSystem(os.path.join(sys.path[0], 'test_data')),
21        object_store_creator)
22    self._example_zipper = ExampleZipper(
23        CompiledFileSystem.Factory(self._file_system, object_store_creator),
24        self._file_system,
25        'example_zipper')
26
27  def testCreateZip(self):
28    # Cache manifest.json as unicode and make sure ExampleZipper doesn't error.
29    self._file_system.ReadSingle('example_zipper/basic/manifest.json')
30    self.assertTrue(len(self._example_zipper.Create('basic')) > 0)
31
32if __name__ == '__main__':
33  unittest.main()
34