Skip to content

Commit

Permalink
Add unit test for mouser package
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeoLacruz committed Dec 29, 2024
1 parent b4fa171 commit e95dcbd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions inventree_supplier_sync/test_supplier_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,24 @@ def test_reformat_mouser_price(self):
self.assertEqual(Mouser.reformat_mouser_price(self, ''), 0)
self.assertEqual(Mouser.reformat_mouser_price(self, 'Mumpitz'), 0)

def test_get_mouser_package(self):

SettingsMixin.set_setting(self, key='MOUSERLANGUAGE', value='German')
part_data = {'ProductAttributes': [
{'AttributeName': 'Verpackung', 'AttributeValue': 'Reel'},
{'AttributeName': 'Verpackung', 'AttributeValue': 'Cut Tape'},
{'AttributeName': 'Verpackung', 'AttributeValue': 'MouseReel',
'AttributeCost': 'Für die MouseReel™ wird Ihrem Warenkorb automatisch eine Gebühr...'},
{'AttributeName': 'Standardpackungsmenge', 'AttributeValue': '3000'}]}

self.assertEqual(Mouser.get_mouser_package(self, part_data), 'Reel, Cut Tape, MouseReel, ')

SettingsMixin.set_setting(self, key='MOUSERLANGUAGE', value='English')
self.assertEqual(Mouser.get_mouser_package(self, part_data), '')

part_data = {}
self.assertEqual(Mouser.get_mouser_package(self, part_data), None)

def test_should_be_updated(self):
cat_include = PartCategory.objects.create(name='cat_include')
cat_ignore = PartCategory.objects.create(name='cat_ignore', metadata={"SupplierSyncPlugin": {"SyncIgnore": True}})
Expand Down

0 comments on commit e95dcbd

Please sign in to comment.