Strengthen account tests
This fell out of Peter Portante's "acctcont-api" branch and seems obviously good. Apparently one of these would've triggered while doing the Pluggable Backend work. Now, why commit this separately while simultaneously working on a big unified Backend Patch? Because posting them separately proves that the test changes worked on the old code. Change-Id: I9ca6ad45fb255f5c0a177a93b93c1acc68da5bbe
This commit is contained in:
parent
4bfe6748fd
commit
fc9f9d7bae
@ -458,10 +458,12 @@ class TestAccountController(unittest.TestCase):
|
|||||||
def test_POST_after_DELETE_not_found(self):
|
def test_POST_after_DELETE_not_found(self):
|
||||||
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
|
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
|
||||||
'HTTP_X_TIMESTAMP': '0'})
|
'HTTP_X_TIMESTAMP': '0'})
|
||||||
req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
|
self.assertEquals(resp.status_int, 201)
|
||||||
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'DELETE',
|
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'DELETE',
|
||||||
'HTTP_X_TIMESTAMP': '1'})
|
'HTTP_X_TIMESTAMP': '1'})
|
||||||
resp = req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
|
self.assertEquals(resp.status_int, 204)
|
||||||
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'POST',
|
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'POST',
|
||||||
'HTTP_X_TIMESTAMP': '2'})
|
'HTTP_X_TIMESTAMP': '2'})
|
||||||
resp = req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
@ -952,7 +954,8 @@ class TestAccountController(unittest.TestCase):
|
|||||||
def test_GET_accept_application_wildcard(self):
|
def test_GET_accept_application_wildcard(self):
|
||||||
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
|
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'PUT',
|
||||||
'HTTP_X_TIMESTAMP': '0'})
|
'HTTP_X_TIMESTAMP': '0'})
|
||||||
req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
|
self.assertEquals(resp.status_int, 201)
|
||||||
req = Request.blank('/sda1/p/a/c1', environ={'REQUEST_METHOD': 'PUT'},
|
req = Request.blank('/sda1/p/a/c1', environ={'REQUEST_METHOD': 'PUT'},
|
||||||
headers={'X-Put-Timestamp': '1',
|
headers={'X-Put-Timestamp': '1',
|
||||||
'X-Delete-Timestamp': '0',
|
'X-Delete-Timestamp': '0',
|
||||||
@ -960,6 +963,7 @@ class TestAccountController(unittest.TestCase):
|
|||||||
'X-Bytes-Used': '0',
|
'X-Bytes-Used': '0',
|
||||||
'X-Timestamp': normalize_timestamp(0)})
|
'X-Timestamp': normalize_timestamp(0)})
|
||||||
resp = req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
|
self.assertEquals(resp.status_int, 201)
|
||||||
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'GET'})
|
req = Request.blank('/sda1/p/a', environ={'REQUEST_METHOD': 'GET'})
|
||||||
req.accept = 'application/*'
|
req.accept = 'application/*'
|
||||||
resp = req.get_response(self.controller)
|
resp = req.get_response(self.controller)
|
||||||
@ -1356,7 +1360,7 @@ class TestAccountController(unittest.TestCase):
|
|||||||
self.assertEqual(resp.status_int, 204,
|
self.assertEqual(resp.status_int, 204,
|
||||||
"%d on param %s" % (resp.status_int, param))
|
"%d on param %s" % (resp.status_int, param))
|
||||||
|
|
||||||
def test_put_auto_create(self):
|
def test_PUT_auto_create(self):
|
||||||
headers = {'x-put-timestamp': normalize_timestamp(1),
|
headers = {'x-put-timestamp': normalize_timestamp(1),
|
||||||
'x-delete-timestamp': normalize_timestamp(0),
|
'x-delete-timestamp': normalize_timestamp(0),
|
||||||
'x-object-count': '0',
|
'x-object-count': '0',
|
||||||
|
Loading…
Reference in New Issue
Block a user