~ubuntu-cloud-archive/ubuntu/precise/nova/trunk

« back to all changes in this revision

Viewing changes to nova/tests/api/openstack/compute/contrib/test_console_output.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Chuck Short, Adam Gandelman
  • Date: 2012-06-22 12:39:57 UTC
  • mfrom: (1.1.57)
  • Revision ID: package-import@ubuntu.com-20120622123957-hbzwg84nt9rqwg8r
Tags: 2012.2~f2~20120621.14517-0ubuntu1
[ Chuck Short ]
* New upstream version.

[ Adam Gandelman ]
* debian/rules: Temporarily disable test suite while blocking
  tests are investigated. 
* debian/patches/kombu_tests_timeout.patch: Dropped.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
#    License for the specific language governing permissions and limitations
14
14
#    under the License.
15
15
 
16
 
import json
17
 
 
18
16
import webob
19
17
 
20
18
from nova import compute
21
19
from nova import exception
 
20
from nova.openstack.common import jsonutils
22
21
from nova import test
23
22
from nova.tests.api.openstack import fakes
24
23
 
56
55
        body = {'os-getConsoleOutput': {}}
57
56
        req = webob.Request.blank('/v2/fake/servers/1/action')
58
57
        req.method = "POST"
59
 
        req.body = json.dumps(body)
 
58
        req.body = jsonutils.dumps(body)
60
59
        req.headers["content-type"] = "application/json"
61
60
 
62
61
        res = req.get_response(fakes.wsgi_app())
63
 
        output = json.loads(res.body)
 
62
        output = jsonutils.loads(res.body)
64
63
        self.assertEqual(res.status_int, 200)
65
64
        self.assertEqual(output, {'output': '0\n1\n2\n3\n4'})
66
65
 
68
67
        body = {'os-getConsoleOutput': {'length': 3}}
69
68
        req = webob.Request.blank('/v2/fake/servers/1/action')
70
69
        req.method = "POST"
71
 
        req.body = json.dumps(body)
 
70
        req.body = jsonutils.dumps(body)
72
71
        req.headers["content-type"] = "application/json"
73
72
        res = req.get_response(fakes.wsgi_app())
74
 
        output = json.loads(res.body)
 
73
        output = jsonutils.loads(res.body)
75
74
        self.assertEqual(res.status_int, 200)
76
75
        self.assertEqual(output, {'output': '2\n3\n4'})
77
76
 
80
79
        body = {'os-getConsoleOutput': {}}
81
80
        req = webob.Request.blank('/v2/fake/servers/1/action')
82
81
        req.method = "POST"
83
 
        req.body = json.dumps(body)
 
82
        req.body = jsonutils.dumps(body)
84
83
        req.headers["content-type"] = "application/json"
85
84
 
86
85
        res = req.get_response(fakes.wsgi_app())
91
90
        body = {'os-getConsoleOutput': {}}
92
91
        req = webob.Request.blank('/v2/fake/servers/1/action')
93
92
        req.method = "POST"
94
 
        req.body = json.dumps(body)
 
93
        req.body = jsonutils.dumps(body)
95
94
        req.headers["content-type"] = "application/json"
96
95
 
97
96
        res = req.get_response(fakes.wsgi_app())
101
100
        body = {}
102
101
        req = webob.Request.blank('/v2/fake/servers/1/action')
103
102
        req.method = "POST"
104
 
        req.body = json.dumps(body)
 
103
        req.body = jsonutils.dumps(body)
105
104
        req.headers["content-type"] = "application/json"
106
105
 
107
106
        res = req.get_response(fakes.wsgi_app())