Exemplo n.º 1
0
    def _run_simple_test(self,
                         source,
                         destination,
                         expected_args=None,
                         expected_code=0,
                         expected_res=SUCCESS,
                         **kwargs):
        s = mswin.Robocopy(source, destination, **kwargs)
        self.setup_step(s)
        s.rendered = True

        command = ['robocopy', source, destination]
        if expected_args:
            command += expected_args
        command += ['/TEE', '/NP']
        self.expect_commands(
            ExpectShell(
                workdir='wkdir',
                command=command,
            ).exit(expected_code))
        state_string = f"'robocopy {source} ...'"
        if expected_res != SUCCESS:
            state_string += f' ({Results[expected_res]})'
        self.expect_outcome(result=expected_res, state_string=state_string)
        return self.run_step()
Exemplo n.º 2
0
    def _run_simple_test(self,
                         source,
                         destination,
                         expected_args=None,
                         expected_code=0,
                         expected_res=SUCCESS,
                         **kwargs):
        s = mswin.Robocopy(source, destination, **kwargs)
        self.setupStep(s)
        s.rendered = True

        command = ['robocopy', source, destination]
        if expected_args:
            command += expected_args
        command += ['/TEE', '/NP']
        self.expectCommands(
            ExpectShell(
                workdir='wkdir',
                command=command,
            ) + expected_code)
        state_string = "'robocopy %s ...'" % source
        if expected_res != SUCCESS:
            state_string += ' (%s)' % (Results[expected_res])
        self.expectOutcome(result=expected_res, state_string=state_string)
        return self.runStep()
Exemplo n.º 3
0
    def _run_simple_test(self,
                         source,
                         destination,
                         expected_args=None,
                         expected_code=0,
                         expected_res=SUCCESS,
                         **kwargs):
        s = mswin.Robocopy(source, destination, **kwargs)
        self.setupStep(s)
        self.assertEqual(s.describe(), ['???'])
        self.assertEqual(s.describe(done=True), ['???'])

        command = ['robocopy', source, destination]
        if expected_args:
            command += expected_args
        command += ['/TEE', '/NP']
        self.expectCommands(
            ExpectShell(
                workdir='wkdir', command=command, usePTY="slave-config") +
            expected_code)
        status_text = ["'robocopy", source, "...'"]
        if expected_res == WARNINGS:
            status_text.append('warnings')
        elif expected_res == FAILURE:
            status_text.append('failed')
        elif expected_res == EXCEPTION:
            status_text.append('exception')
        self.expectOutcome(result=expected_res, status_text=status_text)
        return self.runStep()