blob: 36a4fc88b74cdeddd2df5da3a1dcc5b8f8ca125e [file] [log] [blame]
Joe Gordon7a2cf012014-07-18 11:34:39 +02001# Licensed under the Apache License, Version 2.0 (the "License"); you may
2# not use this file except in compliance with the License. You may obtain
3# a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10# License for the specific language governing permissions and limitations
11# under the License.
12
Matthew Treinishaeb52742014-07-25 18:38:56 -040013from tempest import exceptions
Joe Gordon7a2cf012014-07-18 11:34:39 +020014from tempest.tests import base
15
16
17class TestOutputParser(base.TestCase):
18
19 def test_command_failed_exception(self):
20 returncode = 1
21 cmd = "foo"
22 stdout = "output"
23 stderr = "error"
24 try:
Matthew Treinishaeb52742014-07-25 18:38:56 -040025 raise exceptions.CommandFailed(returncode, cmd, stdout, stderr)
26 except exceptions.CommandFailed as e:
Joe Gordon7a2cf012014-07-18 11:34:39 +020027 self.assertIn(str(returncode), str(e))
28 self.assertIn(cmd, str(e))
29 self.assertIn(stdout, str(e))
30 self.assertIn(stderr, str(e))