def test_no_description_file(self): uploaded_file = self.make_uploaded_file() tempd = self.make_temp_dir() metad = {'name': 'proj', 'version': '1.1'} fk.unpack_project(uploaded_file, metad, tempd) self.assert_not_exists('proj/description.txt')
def test_ensure_description_file(self): uploaded_file = self.make_uploaded_file() tempd = self.make_temp_dir() metad = {'name': 'proj', 'version': '1.1', 'description': 'descr'} fk.unpack_project(uploaded_file, metad, tempd) self.assert_contains('proj/description.txt', metad['description'])
def do_unpacks(self, uploaded_file): tempd = self.make_temp_dir() metad = {'name': 'proj', 'version': '1.1', 'description': 'descr'} fk.unpack_project(uploaded_file, metad, tempd) self.assert_exists('proj') self.assert_exists('proj/1.1') self.assert_exists('proj/1.1/index.html', exists=os.path.isfile) self.assert_exists('proj/description.txt', exists=os.path.isfile)
def test_unpacks(self): tempd = tempfile.mkdtemp("hostthedocs_tests") self.addCleanup(shutil.rmtree, tempd) metad = {"name": "proj", "version": "1.1", "description": "descr"} fk.unpack_project(ZIPFILE, metad, tempd) def assert_exists(tail, exists=os.path.isdir): path = os.path.join(tempd, tail) self.assertTrue(exists(path), "%s does not exist" % path) assert_exists("proj") assert_exists("proj/1.1") assert_exists("proj/1.1/index.html", os.path.isfile) assert_exists("proj/description.txt", os.path.isfile)
def do_unpacks(self, uploaded_file): tempd = tempfile.mkdtemp('hostthedocs_tests') self.addCleanup(shutil.rmtree, tempd) metad = {'name': 'proj', 'version': '1.1', 'description': 'descr'} fk.unpack_project(uploaded_file, metad, tempd) def assert_exists(tail, exists=os.path.isdir): path = os.path.join(tempd, tail) self.assertTrue(exists(path), '%s does not exist' % path) assert_exists('proj') assert_exists('proj/1.1') assert_exists('proj/1.1/index.html', os.path.isfile) assert_exists('proj/description.txt', os.path.isfile)