示例#1
0
    def setUp(self):
        self.cwd = os.getcwd()

        self.local_project_testdir = "build-tests/local-project/build"
        self.local_proj_zip_key = "zip_key.yaml"  # executed from the same directory

        # remove all contents of the build directory and build directory path from prior test run
        if dir_exists('build-tests/local-project/build'):
            shutil.rmtree('build-tests/local-project/build')

        self.assertFalse(dir_exists('build-tests/local-project/build'))

        # create the build directory path
        os.makedirs('build-tests/local-project/build')

        self.assertTrue(dir_exists('build-tests/local-project/build'))

        # move the tar.gz file into the build directory
        fr = FileReader('build-tests/local-project/initializr.zip')
        zip_data = fr.read_bin()
        fw = FileWriter('build-tests/local-project/build/initializr.zip')
        fw.write_bin(zip_data)


        # move the key into the build directory
        fr_key = FileReader('build-tests/local-project/zip_key.yaml')
        zip_key_data = fr_key.read()
        fw_key = FileWriter('build-tests/local-project/build/zip_key.yaml')
        fw_key.write(zip_key_data)


        # confirm that the build files are present
        self.assertTrue(file_exists('build-tests/local-project/build/initializr.zip'))
        self.assertTrue(file_exists('build-tests/local-project/build/zip_key.yaml'))

        # get the expected text for outfile write assertions
        self.fourohfour_text = FileReader('standards/404.html').read()
        self.indexhtml_text = FileReader('standards/index.html').read()
        self.jquery_text = FileReader('standards/jquery.js').read()
        self.normalize_text = FileReader('standards/normalize-min.css').read()