~ubuntu-branches/ubuntu/trusty/heat/trusty-security

« back to all changes in this revision

Viewing changes to heat/tests/test_cli.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-09-08 21:51:19 UTC
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: package-import@ubuntu.com-20130908215119-7tcek6gn73275x5k
Tags: upstream-2013.2~b3
ImportĀ upstreamĀ versionĀ 2013.2~b3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
 
 
3
 
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
4
 
#    not use this file except in compliance with the License. You may obtain
5
 
#    a copy of the License at
6
 
#
7
 
#         http://www.apache.org/licenses/LICENSE-2.0
8
 
#
9
 
#    Unless required by applicable law or agreed to in writing, software
10
 
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
 
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
 
#    License for the specific language governing permissions and limitations
13
 
#    under the License.
14
 
 
15
 
 
16
 
import testtools
17
 
import heat
18
 
import os
19
 
import subprocess
20
 
 
21
 
basepath = os.path.join(heat.__path__[0], os.path.pardir)
22
 
 
23
 
 
24
 
class CliTest(testtools.TestCase):
25
 
 
26
 
    def test_heat_cfn(self):
27
 
            self.bin_run('heat-cfn')
28
 
 
29
 
    def test_heat_boto(self):
30
 
            self.bin_run('heat-boto')
31
 
 
32
 
    def test_heat_watch(self):
33
 
            self.bin_run('heat-watch')
34
 
 
35
 
    def bin_run(self, bin):
36
 
            fullpath = basepath + '/bin/' + bin
37
 
 
38
 
            proc = subprocess.Popen(fullpath,
39
 
                                    stdout=subprocess.PIPE,
40
 
                                    stderr=subprocess.PIPE)
41
 
            stdout, stderr = proc.communicate()
42
 
 
43
 
            if proc.returncode:
44
 
                print('Error executing %s:\n %s %s ' % (bin, stdout, stderr))
45
 
                raise subprocess.CalledProcessError(proc.returncode, bin)