Skip to content

Commit

Permalink
test: fix pricelist tests (frappe#26839)
Browse files Browse the repository at this point in the history
problem: exchange rate API is returning exchange rates for "_Test currency".
These tests were relying on failure of that function.
  • Loading branch information
ankush authored Aug 6, 2021
1 parent a051570 commit 3172794
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
9 changes: 6 additions & 3 deletions erpnext/stock/doctype/batch/test_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,11 +269,14 @@ def test_batch_wise_item_price(self):
batch2 = create_batch('_Test Batch Price Item', 300, 1)
batch3 = create_batch('_Test Batch Price Item', 400, 0)

company = "_Test Company with perpetual inventory"
currency = frappe.get_cached_value("Company", company, "default_currency")

args = frappe._dict({
"item_code": "_Test Batch Price Item",
"company": "_Test Company with perpetual inventory",
"company": company,
"price_list": "_Test Price List",
"currency": "_Test Currency",
"currency": currency,
"doctype": "Sales Invoice",
"conversion_rate": 1,
"price_list_currency": "_Test Currency",
Expand Down Expand Up @@ -333,4 +336,4 @@ def make_new_batch(**args):
except frappe.DuplicateEntryError:
batch = frappe.get_doc("Batch", args.batch_id)

return batch
return batch
9 changes: 6 additions & 3 deletions erpnext/stock/doctype/item/test_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,17 @@ def test_get_item_details(self):

make_test_objects("Item Price")

company = "_Test Company"
currency = frappe.get_cached_value("Company", company, "default_currency")

details = get_item_details({
"item_code": "_Test Item",
"company": "_Test Company",
"company": company,
"price_list": "_Test Price List",
"currency": "_Test Currency",
"currency": currency,
"doctype": "Sales Order",
"conversion_rate": 1,
"price_list_currency": "_Test Currency",
"price_list_currency": currency,
"plc_conversion_rate": 1,
"order_type": "Sales",
"customer": "_Test Customer",
Expand Down

0 comments on commit 3172794

Please sign in to comment.