Skip to content

Commit

Permalink
fix: Server side test
Browse files Browse the repository at this point in the history
- make `tests_that_skip_setup` a tuple (added comma)
- remove manual teardown in `test_job_card_material_transfer_correctness` to avoid premature committing
- transfer_material_against = "Job Card" while making BOM with mulitple operations
  • Loading branch information
marination committed Nov 15, 2021
1 parent 18f9e35 commit bb561ba
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions erpnext/manufacturing/doctype/job_card/test_job_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def setUp(self):
transfer_material_against, source_warehouse = None, None

tests_that_skip_setup = (
"test_job_card_material_transfer_correctness"
"test_job_card_material_transfer_correctness",
)
tests_that_transfer_against_jc = (
"test_job_card_multiple_materials_transfer",
Expand Down Expand Up @@ -272,14 +272,10 @@ def test_job_card_material_transfer_correctness(self):
self.assertEqual(transfer_entry.items[0].item_code, "_Test Item")
self.assertEqual(transfer_entry.items[0].qty, 2)

# teardown
transfer_entry.delete()
frappe.db.delete("Job Card", {"work_order": work_order.name})
work_order.cancel()
bom.cancel()

# rollback via tearDown method

def create_bom_with_multiple_operations():
"Create a BOM with multiple operations and Material Transfer against Job Card"
from erpnext.manufacturing.doctype.operation.test_operation import make_operation

test_record = frappe.get_test_records("BOM")[2]
Expand All @@ -303,6 +299,7 @@ def create_bom_with_multiple_operations():
"operating_cost": 100
})

bom_doc.transfer_material_against = "Job Card"
bom_doc.save()
bom_doc.submit()

Expand Down

0 comments on commit bb561ba

Please sign in to comment.