cron faircot
This commit is contained in:
@@ -279,6 +279,28 @@ class PurchaseTradeTestCase(ModuleTestCase):
|
||||
party.get_sla_cost(Mock()),
|
||||
(None, None, None, None))
|
||||
|
||||
def test_get_party_by_name_adds_missing_category_to_existing_party(self):
|
||||
'existing parties found by automation gain the requested category when missing'
|
||||
Party = Pool().get('party.party')
|
||||
existing_party = Mock(id=12)
|
||||
category = Mock(id=34)
|
||||
category_model = Mock()
|
||||
category_model.search.return_value = [category]
|
||||
party_category_model = Mock()
|
||||
party_category_model.search.return_value = []
|
||||
|
||||
with patch.object(Party, 'search', return_value=[existing_party]), patch(
|
||||
'trytond.modules.purchase_trade.party.Pool') as PoolMock:
|
||||
PoolMock.return_value.get.side_effect = lambda name: {
|
||||
'party.category': category_model,
|
||||
'party.party-party.category': party_category_model,
|
||||
}[name]
|
||||
|
||||
party = Party.getPartyByName('SYED SP COT D BD', 'CLIENT')
|
||||
|
||||
self.assertIs(party, existing_party)
|
||||
party_category_model.save.assert_called_once()
|
||||
|
||||
def test_create_fee_skips_when_controller_has_no_sla_cost(self):
|
||||
'shipment fee creation skips cleanly when controller has no matching sla'
|
||||
ShipmentIn = Pool().get('stock.shipment.in')
|
||||
|
||||
Reference in New Issue
Block a user