def test_copy_one(self): """Tests copying one file.""" for to_copy in ['register_sw.js', 'sw_static.js', os.path.join('polyfills', 'tts.polyfill.js')]: caterpillar.copy_static_code([to_copy], self.output_path, BOILERPLATE_DIR) self.assertTrue( os.path.exists( os.path.join(self.output_path, BOILERPLATE_DIR, to_copy)), 'File {} was not copied.'.format(to_copy))
def test_copy_many(self): """Tests copying many files.""" to_copy = ['register_sw.js', 'sw_static.js', os.path.join('polyfills', 'tts.polyfill.js')] caterpillar.copy_static_code(to_copy, self.output_path, BOILERPLATE_DIR) for filename in to_copy: self.assertTrue( os.path.exists( os.path.join(self.output_path, BOILERPLATE_DIR, filename)), 'File {} was not copied.'.format(filename))
def test_no_copy(self): """Tests copying no files.""" existing_files = [] for root, _, files in os.walk(self.output_path): for name in files: existing_files.append(os.path.join(root, name)) caterpillar.copy_static_code([], self.output_path, BOILERPLATE_DIR) for root, _, files in os.walk(self.output_path): for name in files: path = os.path.join(root, name) self.assertIn(path, existing_files, 'File {} was copied.'.format(path))
def test_copy_one(self): """Tests copying one file.""" for to_copy in [ 'register_sw.js', 'sw_static.js', os.path.join('polyfills', 'tts.polyfill.js') ]: caterpillar.copy_static_code([to_copy], self.output_path, BOILERPLATE_DIR) self.assertTrue( os.path.exists( os.path.join(self.output_path, BOILERPLATE_DIR, to_copy)), 'File {} was not copied.'.format(to_copy))
def test_copy_many(self): """Tests copying many files.""" to_copy = [ 'register_sw.js', 'sw_static.js', os.path.join('polyfills', 'tts.polyfill.js') ] caterpillar.copy_static_code(to_copy, self.output_path, BOILERPLATE_DIR) for filename in to_copy: self.assertTrue( os.path.exists( os.path.join(self.output_path, BOILERPLATE_DIR, filename)), 'File {} was not copied.'.format(filename))