~ubuntu-branches/ubuntu/utopic/python-ceilometerclient/utopic

« back to all changes in this revision

Viewing changes to ceilometerclient/tests/test_shell.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, James Page, Chuck Short
  • Date: 2014-01-21 09:53:01 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20140121095301-cwxsrtdgddkzprjx
Tags: 1.0.8-0ubuntu1
[ James Page ]
* d/control: Add missing BD on python-babel. 

[ Chuck Short ]
* New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
#   License for the specific language governing permissions and limitations
11
11
#   under the License.
12
12
 
13
 
import cStringIO
14
13
import httplib2
15
14
import re
 
15
import six
16
16
import sys
17
17
 
18
18
import fixtures
 
19
import mock
19
20
from testtools import matchers
20
21
 
21
22
from keystoneclient.v2_0 import client as ksclient
41
42
 
42
43
    def setUp(self):
43
44
        super(ShellTest, self).setUp()
44
 
        self.m.StubOutWithMock(ksclient, 'Client')
45
 
        self.m.StubOutWithMock(v1client.Client, 'json_request')
46
 
        self.m.StubOutWithMock(v1client.Client, 'raw_request')
47
45
 
48
 
    def shell(self, argstr):
 
46
    @mock.patch.object(ksclient, 'Client')
 
47
    @mock.patch.object(v1client.Client, 'json_request')
 
48
    @mock.patch.object(v1client.Client, 'raw_request')
 
49
    def shell(self, argstr, mock_ksclient, mock_json, mock_raw):
49
50
        orig = sys.stdout
50
51
        try:
51
 
            sys.stdout = cStringIO.StringIO()
 
52
            sys.stdout = six.StringIO()
52
53
            _shell = ceilometer_shell.CeilometerShell()
53
54
            _shell.main(argstr.split())
54
55
        except SystemExit: