Browse Source

added Order.platform_view_url

Fabian Peter Hammerle 6 years ago
parent
commit
9829a4dda7
2 changed files with 12 additions and 4 deletions
  1. 5 1
      finoex/__init__.py
  2. 7 3
      tests/test_yaml.py

+ 5 - 1
finoex/__init__.py

@@ -182,8 +182,9 @@ class Order(_Object, _ItemCollection, _YamlInitConstructor, _YamlVarsRepresenter
 
     def __init__(self, platform, order_id, order_date,
                  customer_id=None,
-                 items=None,
                  discounts=None,
+                 items=None,
+                 platform_view_url=None,
                  ):
         assert type(platform) is str
         self.platform = platform
@@ -204,6 +205,9 @@ class Order(_Object, _ItemCollection, _YamlInitConstructor, _YamlVarsRepresenter
             assert type(discounts) is list
             assert all([isinstance(d, Discount) for d in discounts])
             self.discounts = discounts
+        if platform_view_url:
+            assert isinstance(platform_view_url, str)
+            self.platform_view_url = platform_view_url
         _ItemCollection.__init__(self, items)
 
 

+ 7 - 3
tests/test_yaml.py

@@ -223,10 +223,11 @@ def get_discount_c():
 
 def get_order_a(items = True, discounts = True):
     order = finoex.Order(
-            platform = u'platformπ',
-            order_id = u'id',
-            order_date = datetime.datetime(2016, 5, 8, 0, 18, 17),
             customer_id = u'customer',
+            order_date = datetime.datetime(2016, 5, 8, 0, 18, 17),
+            order_id = u'id',
+            platform = u'platformπ',
+            platform_view_url = 'http://i.dont.know',
             )
     if items:
         order.items.append(get_item_a())
@@ -405,6 +406,7 @@ items:
 order_date: 2016-05-08 00:18:17
 order_id: id
 platform: platformπ
+platform_view_url: http://i.dont.know
 """],
     [get_order_a(discounts = False), u"""!order
 customer_id: customer
@@ -418,6 +420,7 @@ items:
 order_date: 2016-05-08 00:18:17
 order_id: id
 platform: platformπ
+platform_view_url: http://i.dont.know
 """],
     [get_article(), u"""!article
 authors:
@@ -669,6 +672,7 @@ items:
 order_date: 2016-05-08 00:18:17
 order_id: id
 platform: platformπ
+platform_view_url: http://i.dont.know
 """],
     [get_article(), u"""!article
 authors: