def test_explicit_template_name(self): with temp_dir() as tmp_dir: old_dir = os.getcwd() os.chdir(tmp_dir) test_dir = os.path.dirname(__file__) project_sample_path = os.path.join(test_dir, "files/project_sample") start_project.main(project_name="test_project", template=project_sample_path) self.assertTrue(os.path.join(tmp_dir, "test_project/foo.py")) os.chdir(old_dir)
def test_explicit_template_name(self): with temp_dir() as tmp_dir: old_dir = os.getcwd() os.chdir(tmp_dir) test_dir = os.path.dirname(__file__) project_sample_path = os.path.join(test_dir, 'files/project_sample') start_project.main(project_name='test_project', template=project_sample_path) self.assertTrue(os.path.join(tmp_dir, 'test_project/foo.py')) os.chdir(old_dir)
def test_start_project(self): with temp_dir() as tmp_dir: old_dir = os.getcwd() os.chdir(tmp_dir) dir_ = os.path.join(tmp_dir, 'test_project') start_project.main(project_name='test_project', template=None) os.chdir(old_dir) self.assertTrue(os.path.exists(os.path.join(dir_, 'var'))) self.assertTrue(os.path.exists(os.path.join(dir_, 'var/log'))) self.assertTrue(os.path.exists(os.path.join(dir_, 'var/run'))) path = os.path.join(dir_, 'spider.py') self.assertTrue('TestProjectSpider' in open(path).read())
def test_start_project(self): with temp_dir() as tmp_dir: old_dir = os.getcwd() os.chdir(tmp_dir) dir_ = os.path.join(tmp_dir, "test_project") start_project.main(project_name="test_project", template=None) os.chdir(old_dir) self.assertTrue(os.path.exists(os.path.join(dir_, "var"))) self.assertTrue(os.path.exists(os.path.join(dir_, "var/log"))) self.assertTrue(os.path.exists(os.path.join(dir_, "var/run"))) path = os.path.join(dir_, "spider.py") self.assertTrue("TestProjectSpider" in open(path).read())
def test_explicit_template_name(self): old_dir = os.getcwd() os.chdir(TMP_DIR) test_dir = os.path.dirname(__file__) project_sample_path = os.path.join(test_dir, 'files/project_sample') start_project.main(project_name='test_project', template=project_sample_path) self.assertTrue(os.path.join(TMP_DIR, 'test_project/foo.py')) os.chdir(old_dir) dir_ = os.path.join(TMP_DIR, 'test_project') clear_directory(dir_) os.rmdir(dir_)
def test_start_project(self): old_dir = os.getcwd() os.chdir(TMP_DIR) dir_ = os.path.join(TMP_DIR, 'test_project') start_project.main(project_name='test_project', template=None) os.chdir(old_dir) self.assertTrue( os.path.exists(os.path.join(TMP_DIR, 'test_project/var'))) self.assertTrue( os.path.exists(os.path.join(TMP_DIR, 'test_project/var/log'))) self.assertTrue( os.path.exists(os.path.join(TMP_DIR, 'test_project/var/run'))) path = os.path.join(TMP_DIR, 'test_project/spider.py') self.assertTrue('TestProjectSpider' in open(path).read()) clear_directory(dir_) os.rmdir(dir_)
def test_start_project(self): old_dir = os.getcwd() os.chdir(TMP_DIR) dir_ = os.path.join(TMP_DIR, 'test_project') start_project.main(project_name='test_project', template=None) os.chdir(old_dir) self.assertTrue(os.path.exists(os.path.join(TMP_DIR, 'test_project/var'))) self.assertTrue(os.path.exists(os.path.join(TMP_DIR, 'test_project/var/log'))) self.assertTrue(os.path.exists(os.path.join(TMP_DIR, 'test_project/var/run'))) path = os.path.join(TMP_DIR, 'test_project/spider.py') self.assertTrue( 'TestProjectSpider' in open(path).read()) clear_directory(dir_) os.rmdir(dir_)