def get_orderResource(self, order_id): order_db = Order.query.get(order_id) order = acmeOrder.from_json(json.loads(order_db.contents)['body']) orderr = OrderResource.from_json(json.loads(order_db.contents)) authorizations = [] for url in order.authorizations: authorizations.append( self.client._authzr_from_response( self.client._post_as_get(url), uri=url)) return orderr.update(authorizations=authorizations)
class OrderResourceTest(unittest.TestCase): """Tests for acme.messages.OrderResource.""" def setUp(self): from acme.messages import OrderResource self.regr = OrderResource( body=mock.sentinel.body, uri=mock.sentinel.uri) def test_to_partial_json(self): self.assertEqual(self.regr.to_json(), { 'body': mock.sentinel.body, 'uri': mock.sentinel.uri, 'authorizations': None, })
def setUp(self): from acme.messages import OrderResource self.regr = OrderResource( body=mock.sentinel.body, uri=mock.sentinel.uri)