def test_serialize_an_order(self):
     """ Serialization of an Order """
     date = datetime.now
     order_item = OrderItem(product_id=1, quantity=1, price=5, status="PLACED")
     order_item2 = OrderItem(product_id=2, quantity=1, price=5, status="PLACED")
     order_items = [order_item, order_item2]
     order = Order(customer_id=123, created_date=date, order_items=order_items)
     data = order.serialize()
     self.assertNotEqual(data, None)
     self.assertIn("id", data)
     self.assertEqual(data["id"], None)
     self.assertIn("customer_id", data)
     self.assertEqual(data["customer_id"], 123)
     self.assertIn("created_date", data)
     self.assertEqual(data["created_date"], date)
     self.assertIn("order_items", data)
     self.assertEqual(data["order_items"], [order_item.serialize(), order_item2.serialize()])
 def test_serialize_an_order_item(self):
     """ Serialization of an Order Item """
     order_item = OrderItem(product_id=1, quantity=1, price=5, status="PLACED")
     data = order_item.serialize()
     self.assertNotEqual(data, None)
     self.assertIn("item_id", data)
     self.assertEqual(data["item_id"], None)
     self.assertIn("product_id", data)
     self.assertEqual(data["product_id"], 1)
     self.assertIn("quantity", data)
     self.assertEqual(data["quantity"], 1)
     self.assertIn("price", data)
     self.assertEqual(data["price"], 5)
     self.assertIn("status", data)
     self.assertEqual(data["status"], "PLACED")