예제 #1
0
    def test_check_cwd_is_project(self):
        not_project_path = self._get_file_path('')
        project_path = os.path.join(
            os.getcwd(),
            'tests/cases/project',
        )

        PathResolver.set_project_path(not_project_path)
        self.assertFalse(check_cwd_is_project())

        PathResolver.set_project_path(project_path)
        self.assertTrue(check_cwd_is_project())
예제 #2
0
    def test_not_in_project(self):
        not_project_path = self._get_path('tests/cases')
        PathResolver.set_project_path(not_project_path)
        template = 'simple'

        sys.argv = ['geekcms', 'startproject', template]

        self.assertEqual(
            _not_in_project(),
            template,
        )
        shutil.rmtree(
            os.path.join(not_project_path, template),
        )
예제 #3
0
    def test_in_project(self):

        project_path = self._get_path('tests/cases/project')
        PathResolver.set_project_path(project_path)

        sys.argv = ['geekcms', 'run']
        command = _in_project()
        self.assertEqual(
            command,
            'run',
        )

        sys.argv = ['geekcms', 'testcmd', '-a', '-b', 'c', 'd']
        command = _in_project()
        self.assertEqual(
            command,
            'testcmd',
        )
예제 #4
0
 def setUp(self):
     self.project_path = self._get_file_path('')
     PathResolver.set_project_path(self.project_path)