def __init__(self, basedir): self.basedir = basedir self.name = TestUtils.random_numeric_string(6, 'testdir_') self.path = os.path.join(self.basedir, self.name) self.settings = None session.testdir = self.path commands.createdirectory_command(self.path)
def __init__(self, basedir): self.basedir = basedir self.name = TestUtils.random_string(4, 'testdir_') self.path = os.path.join(self.basedir, self.name) self.settings = None os.chdir(self.basedir) commands.createdirectory_command(self.name)
def test_specify_golem_test_directory_path(self, dir_function, test_utils): """The path to the Golem test directory can be specified using the golem-dir argument """ os.chdir(dir_function.path) golem_dir_name = 'golem_dir' golem_directory = os.path.join(dir_function.path, golem_dir_name) commands.createdirectory_command(golem_directory, download_drivers=False) # createproject command in a non golem directory # without golem-dir argument command = 'golem createproject project_one' result = test_utils.run_command(command) msg = ('Error: {} is not an valid Golem test directory; ' '.golem file not found'.format(dir_function.path)) assert msg in result # specify golem-dir with absolute path command = 'golem --golem-dir {} createproject project_two'.format( golem_directory) result = test_utils.run_command(command) assert 'Project project_two created' in result # specify golem-dir with relative path command = 'golem --golem-dir {} createproject project_three'.format( golem_dir_name) result = test_utils.run_command(command) assert 'Project project_three created' in result
def _create_testdir(base_dir): base_dir = get_base_dir() os.chdir(base_dir) testdir_name = Test_utils.random_string(4, 'testdir_') full_path = os.path.join(base_dir, testdir_name) commands.createdirectory_command(testdir_name) return testdir_name, full_path
def test_createdirectory_command(self, dir_function): os.chdir(dir_function.path) name = 'testdirectory_002' commands.createdirectory_command(name, download_drivers=False) testdir = os.path.join(dir_function.path, name) assert os.path.isdir(testdir) driversdir = os.path.join(testdir, 'drivers') assert os.listdir(driversdir) == []
def _create_testdir(base_dir): base_dir = get_base_dir() os.chdir(base_dir) testdir_name = Test_utils.random_string(4, 'testdir_') full_path = os.path.join(base_dir, testdir_name) # call(['golem-admin', 'createdirectory', testdir_name]) from golem.cli import commands commands.createdirectory_command(testdir_name) return testdir_name, full_path
def main(): parser = argument_parser.get_admin_parser() args = parser.parse_args() if args.help: print(messages.ADMIN_USAGE_MSG) elif args.command: if args.command == 'createdirectory': commands.createdirectory_command(args.name) else: print(messages.ADMIN_USAGE_MSG)
def test_createdirectory_absolute_path(self, dir_function, test_utils, capsys): """A test directory can be created using an absolute path""" name = 'testdir_test_003' full_path = os.path.join(dir_function.path, name) commands.createdirectory_command(full_path, download_drivers=False) assert os.path.exists(full_path) expected = ('New golem test directory created at {}\n' 'Use these credentials to access the GUI module:\n' ' user: admin\n' ' password: admin'.format(full_path)) captured = capsys.readouterr() assert expected in captured.out
def test_createdirectory_command(self, dir_function): name = 'testdirectory_002' commands.createdirectory_command(name) testdir = os.path.join(dir_function.path, name) assert os.path.isdir(testdir)