Beispiel #1
0
 def test_lines(self):
     item1 = {
         'invoiceNumber': '1',
         'lines': [{
             'sku': '2',
             'qtyOrdered': 5,
             'qtyShipped': 1
         }]
     }
     item2 = {
         'invoiceNumber':
         '3',
         'lines': [{
             'sku': '4',
             'qtyOrdered': 6,
             'qtyShipped': 2
         }, {
             'sku': '5',
             'qtyOrdered': 7,
             'qtyShipped': 3
         }, {
             'sku': '6',
             'qtyOrdered': 8,
             'qtyShipped': 4
         }]
     }
     order1 = ssactivewear.Order([item1])
     order2 = ssactivewear.Order([item1, item2])
     assert order1.lines() == [{
         'invoice': '1',
         'sku': '2',
         'qty_ordered': 5,
         'qty_shipped': 1
     }]
     assert order2.lines() == [{
         'invoice': '1',
         'sku': '2',
         'qty_ordered': 5,
         'qty_shipped': 1
     }, {
         'invoice': '3',
         'sku': '4',
         'qty_ordered': 6,
         'qty_shipped': 2
     }, {
         'invoice': '3',
         'sku': '5',
         'qty_ordered': 7,
         'qty_shipped': 3
     }, {
         'invoice': '3',
         'sku': '6',
         'qty_ordered': 8,
         'qty_shipped': 4
     }]
Beispiel #2
0
 def test_data_nums(self):
     order1 = ssactivewear.Order([])
     order2 = ssactivewear.Order([{'invoiceNumber': '9'}])
     order3 = ssactivewear.Order([{
         'invoiceNumber': '10'
     }, {
         'invoiceNumber': '11'
     }])
     assert order1._data_nums('invoiceNumber') == []
     assert order2._data_nums('invoiceNumber') == ['9']
     assert order3._data_nums('invoiceNumber') == ['10', '11']
Beispiel #3
0
 def test_invoices(self):
     order = ssactivewear.Order([{
         'invoiceNumber': '5'
     }, {
         'invoiceNumber': '6'
     }])
     assert order.invoices() == ['5', '6']
Beispiel #4
0
 def test_order_nums(self):
     order = ssactivewear.Order([{
         'orderNumber': '3'
     }, {
         'orderNumber': '4'
     }])
     assert order.order_nums() == ['3', '4']
Beispiel #5
0
 def test_tracking_nums(self):
     order = ssactivewear.Order([{
         'trackingNumber': '1'
     }, {
         'trackingNumber': '2'
     }])
     assert order.tracking_nums() == ['1', '2']
Beispiel #6
0
 def test_guids(self):
     order = ssactivewear.Order([{'guid': '7'}, {'guid': '8'}])
     assert order.guids() == ['7', '8']
Beispiel #7
0
 def test_repr(self):
     order = ssactivewear.Order([{'A': 1}, {'B': 2}])
     assert str(order) == "Order([{'A': 1}, {'B': 2}])"
Beispiel #8
0
 def test_data(self):
     order = ssactivewear.Order([{'A': 1}, {'B': 2}])
     assert order.data() == [{'A': 1}, {'B': 2}]