def test_show(self): c = Controller({'account_id': self.account_id, 'id': 'test'}, self.mock_app) req = Request.blank('?size=1&volume_type_name=vtype') c.create(req) req = Request.blank('') res = c.show(req) self.assertEqual(res.body['id'], 'test') c = Controller( { 'account_id': self.account_id, 'id': '00000000-0000-0000-0000-000000000000', }, self.mock_app) req = Request.blank('') self.assertRaises(HTTPNotFound, c.show, req)
def test_show_fails_after_account_is_deleted(self): # create volume c = Controller({'account_id': self.account_id, 'id': 'test'}, self.mock_app) req = Request.blank('?size=1&volume_type_name=vtype') c.create(req) # delete account self.account.status = 'DELETED' self.db.add(self.account) self.db.commit() # should raise not found c = Controller({'account_id': self.account_id, 'id': 'test'}, self.mock_app) req = Request.blank('') self.assertRaises(HTTPNotFound, c.show, req) # admin still works c = Controller({'account_id': 'admin', 'id': 'test'}, self.mock_app) req = Request.blank('') res = c.show(req) self.assertEqual(res.body['id'], 'test')