Skip to content

Commit

Permalink
Change return value matching with the comment
Browse files Browse the repository at this point in the history
Fix failing test

* Rename it because it was shadowing another test
* Compute in the location's context
  • Loading branch information
guewen authored and hugosantosred committed Mar 6, 2018
1 parent f113181 commit 2980ffa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion connector_magento/components/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def _should_import(self):
attributes=['updated_at'])
if not record['updated_at']:
# in rare case it can be empty, in doubt, import it
return False
return True
sync_date = odoo.fields.Datetime.from_string(sync)
magento_date = datetime.strptime(record['updated_at'],
MAGENTO_DATETIME_FORMAT)
Expand Down
3 changes: 2 additions & 1 deletion connector_magento/tests/test_export_product_stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,15 @@ def test_export_product_inventory_write_job(self):
self.parse_cassette_request(cassette.requests[1].body)
)

def test_compute_new_qty(self):
def test_compute_new_qty_with_location(self):
product = self.binding_product.odoo_id
binding = self.binding_product
# start with 0
self.assertEqual(product.virtual_available, 0.0)
self.assertEqual(binding.magento_qty, 0.0)

my_location_id = self.env.ref("stock.stock_location_components").id
binding = binding.with_context(location=my_location_id)

# change to 30
self._product_change_qty(product, 30)
Expand Down

0 comments on commit 2980ffa

Please sign in to comment.