Exemplo n.º 1
0
    def _getLegacySummary(self, done):
        # defer to the describe method, if set
        description = self.describe(done)
        if description:
            return join_list(description)

        # defer to descriptions, if they're set
        if (not done and self.description) or (done and self.descriptionDone):
            return None

        try:
            # if self.cmd is set, then use the RemoteCommand's info
            if self.cmd:
                command = self.cmd.remote_command
            # otherwise, if we were configured with a command, use that
            elif self.command:
                command = self.command
            else:
                return None

            rv = command_to_string(command)

            # add the descriptionSuffix, if one was given
            if self.descriptionSuffix:
                rv = rv + u' ' + join_list(self.descriptionSuffix)

            return rv

        except Exception:
            log.err(failure.Failure(), "Error describing step")
            return None
Exemplo n.º 2
0
    def _getLegacySummary(self, done):
        # defer to the describe method, if set
        description = self.describe(done)
        if description:
            return join_list(description)

        # defer to descriptions, if they're set
        if (not done and self.description) or (done and self.descriptionDone):
            return None

        try:
            # if self.cmd is set, then use the RemoteCommand's info
            if self.cmd:
                command = self.cmd.remote_command
            # otherwise, if we were configured with a command, use that
            elif self.command:
                command = self.command
            else:
                return None

            rv = command_to_string(command)

            # add the descriptionSuffix, if one was given
            if self.descriptionSuffix:
                rv = rv + u' ' + join_list(self.descriptionSuffix)

            return rv

        except Exception:
            log.err(failure.Failure(), "Error describing step")
            return None
Exemplo n.º 3
0
 def getResultSummary(self):
     if self.descriptionDone is not None:
         return super().getResultSummary()
     summary = util.command_to_string(self.command)
     if summary:
         if self.results != SUCCESS:
             summary += ' ({})'.format(Results[self.results])
         return {'step': summary}
     return super().getResultSummary()
Exemplo n.º 4
0
 def getResultSummary(self):
     summary = util.command_to_string(self.command)
     if not summary:
         return super(ShellMixin, self).getResultSummary()
     return {u'step': summary}
Exemplo n.º 5
0
 def test_invalid_ascii(self):
     self.assertEqual(util.command_to_string('a\xffc'), u"'a\ufffdc'")
Exemplo n.º 6
0
 def test_list_with_objects(self):
     # the object looks like a renderable, and is skipped
     self.assertEqual(util.command_to_string(['ab', object(), 'cd']),
                      u"'ab cd'")
Exemplo n.º 7
0
 def test_object(self):
     # this looks like a renderable
     self.assertEqual(util.command_to_string(object()), None)
Exemplo n.º 8
0
 def test_nested_list(self):
     self.assertEqual(util.command_to_string(['ab', ['cd', ['ef']]]),
                      u"'ab cd ...'")
Exemplo n.º 9
0
 def test_long_string(self):
     self.assertEqual(util.command_to_string("ab cd ef"), u"'ab cd ...'")
Exemplo n.º 10
0
 def test_long_string(self):
     self.assertEqual(util.command_to_string("ab cd ef"), u"'ab cd ...'")
Exemplo n.º 11
0
 def test_list(self):
     self.assertEqual(util.command_to_string(['ab', 'cd', 'ef']),
                      "'ab cd ...'")
Exemplo n.º 12
0
 def test_invalid_ascii(self):
     self.assertEqual(util.command_to_string('a\xffc'), u"'a\ufffdc'")
Exemplo n.º 13
0
 def test_list_with_objects(self):
     # the object looks like a renderable, and is skipped
     self.assertEqual(util.command_to_string(['ab', object(), 'cd']),
                      u"'ab cd'")
Exemplo n.º 14
0
 def test_object(self):
     # this looks like a renderable
     self.assertEqual(util.command_to_string(object()), None)
Exemplo n.º 15
0
 def test_nested_list(self):
     self.assertEqual(util.command_to_string(['ab', ['cd', ['ef']]]),
                      u"'ab cd ...'")
Exemplo n.º 16
0
 def getResultSummary(self):
     summary = util.command_to_string(self.command)
     if not summary:
         return super(ShellMixin, self).getResultSummary()
     return {u'step': summary}
Exemplo n.º 17
0
 def test_short_string(self):
     self.assertEqual(util.command_to_string("ab cd"), u"'ab cd'")
Exemplo n.º 18
0
 def test_list(self):
     self.assertEqual(util.command_to_string(['ab', 'cd', 'ef']),
                      "'ab cd ...'")
Exemplo n.º 19
0
 def test_short_string(self):
     self.assertEqual(util.command_to_string("ab cd"), u"'ab cd'")