def test_should_get_purchase_orders_without_release_orders(self):
        purchase_order = PurchaseOrderFactory()
        create_release_order(self)

        response = self.client.get(ENDPOINT_URL + 'for_direct_delivery/')
        self.assertEqual(response.status_code, 200)
        self.assertEqual(len(response.data), 1)
        self.assertListEqual([purchase_order.id], [order['id'] for order in response.data])

        response = self.client.get(ENDPOINT_URL)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(len(response.data), 2)
예제 #2
0
    def test_should_get_purchase_orders_without_release_orders(self):
        purchase_order = PurchaseOrderFactory()
        create_release_order(self)

        response = self.client.get(ENDPOINT_URL + 'for_direct_delivery/')
        self.assertEqual(response.status_code, 200)
        self.assertEqual(len(response.data), 1)
        self.assertListEqual([purchase_order.id],
                             [order['id'] for order in response.data])

        response = self.client.get(ENDPOINT_URL)
        self.assertEqual(response.status_code, 200)
        self.assertEqual(len(response.data), 2)
    def test_should_get_release_orders(self):
        sales_order = SalesOrderFactory()
        consignee = ConsigneeFactory()

        release_order_details = {'order_number': "232345434", 'delivery_date': '2014-10-05',
                                 'sales_order': sales_order.id, 'consignee': consignee.id, 'waybill': '234256'}

        created_release_order = create_release_order(self, release_order_details=release_order_details)

        self.assertDictContainsSubset(release_order_details, created_release_order)
        self.assertDictContainsSubset({'releaseorderitem_set': []}, created_release_order)
    def test_should_get_release_orders(self):
        sales_order = SalesOrderFactory()
        purchase_order = PurchaseOrderFactory()
        consignee = ConsigneeFactory()
        release_order_details = {'order_number': 232345434, 'delivery_date': '2014-10-05',
                                 'sales_order': sales_order.id, 'purchase_order': purchase_order.id,
                                 'consignee': consignee.id, 'waybill': 234256}
        created_release_order, _ = create_release_order(self, release_order_details=release_order_details)

        self.assertDictContainsSubset(release_order_details, created_release_order)
        self.assertDictContainsSubset({'items': []}, created_release_order)
        self.assertDictContainsSubset({'programme': sales_order.programme.name}, created_release_order)
예제 #5
0
    def test_should_get_release_orders(self):
        sales_order = SalesOrderFactory()
        purchase_order = PurchaseOrderFactory()
        consignee = ConsigneeFactory()
        release_order_details = {
            'order_number': 232345434,
            'delivery_date': '2014-10-05',
            'sales_order': sales_order.id,
            'purchase_order': purchase_order.id,
            'consignee': consignee.id,
            'waybill': 234256
        }
        created_release_order, _ = create_release_order(
            self, release_order_details=release_order_details)

        self.assertDictContainsSubset(release_order_details,
                                      created_release_order)
        self.assertDictContainsSubset({'items': []}, created_release_order)
        self.assertDictContainsSubset(
            {'programme': sales_order.programme.name}, created_release_order)