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

« back to all changes in this revision

Viewing changes to nova/tests/api/openstack/compute/contrib/test_accounts.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
 
 
17
 
import json
18
 
 
19
16
from lxml import etree
20
17
import webob
21
18
 
22
19
from nova.api.openstack.compute.contrib import accounts
23
20
from nova.auth import manager as auth_manager
 
21
from nova.openstack.common import jsonutils
24
22
from nova import test
25
23
from nova.tests.api.openstack import fakes
26
24
 
51
49
    def test_get_account(self):
52
50
        req = webob.Request.blank('/v2/fake/accounts/test1')
53
51
        res = req.get_response(fakes.wsgi_app())
54
 
        res_dict = json.loads(res.body)
 
52
        res_dict = jsonutils.loads(res.body)
55
53
 
56
54
        self.assertEqual(res.status_int, 200)
57
55
        self.assertEqual(res_dict['account']['id'], 'test1')
82
80
        req = webob.Request.blank('/v2/fake/accounts/newacct')
83
81
        req.headers["Content-Type"] = "application/json"
84
82
        req.method = 'PUT'
85
 
        req.body = json.dumps(body)
 
83
        req.body = jsonutils.dumps(body)
86
84
 
87
85
        res = req.get_response(fakes.wsgi_app())
88
 
        res_dict = json.loads(res.body)
 
86
        res_dict = jsonutils.loads(res.body)
89
87
 
90
88
        self.assertEqual(res.status_int, 200)
91
89
        self.assertEqual(res_dict['account']['id'], 'newacct')
102
100
        req = webob.Request.blank('/v2/fake/accounts/newacct.xml')
103
101
        req.headers["Content-Type"] = "application/json"
104
102
        req.method = 'PUT'
105
 
        req.body = json.dumps(body)
 
103
        req.body = jsonutils.dumps(body)
106
104
 
107
105
        res = req.get_response(fakes.wsgi_app())
108
106
        res_tree = etree.fromstring(res.body)
123
121
        req = webob.Request.blank('/v2/fake/accounts/test1')
124
122
        req.headers["Content-Type"] = "application/json"
125
123
        req.method = 'PUT'
126
 
        req.body = json.dumps(body)
 
124
        req.body = jsonutils.dumps(body)
127
125
 
128
126
        res = req.get_response(fakes.wsgi_app())
129
 
        res_dict = json.loads(res.body)
 
127
        res_dict = jsonutils.loads(res.body)
130
128
 
131
129
        self.assertEqual(res.status_int, 200)
132
130
        self.assertEqual(res_dict['account']['id'], 'test1')
141
139
        req = webob.Request.blank('/v2/fake/accounts/test1.xml')
142
140
        req.headers["Content-Type"] = "application/json"
143
141
        req.method = 'PUT'
144
 
        req.body = json.dumps(body)
 
142
        req.body = jsonutils.dumps(body)
145
143
 
146
144
        res = req.get_response(fakes.wsgi_app())
147
145
        res_tree = etree.fromstring(res.body)