Ejemplo n.º 1
0
 async def redis_handle(self, channel, message):
     if channel == 'enibar-notes':
         for note in message:
             api.notes.rebuild_note_cache(note)
         await api.sde.send_notes(message)
         self.rebuild_notes_list()
     elif channel == 'enibar-delete':
         for note in message:
             try:
                 note_id = api.notes.NOTES_CACHE[note]['id']
                 await api.sde.send_note_deletion([
                     note_id,
                 ])
                 del api.notes.NOTES_CACHE[note]
             except KeyError:  # Osef
                 pass
         self.rebuild_notes_list()
     elif channel == "enibar-alcohol":
         self.check_alcohol()
     elif channel == "enibar-settings":
         settings.refresh_cache()
         self.panels.rebuild()
     elif channel == "enibar-panels":
         self.panels.rebuild()
     try:
         self.menu_bar.cur_window.redis_handle(channel, message)
     except AttributeError:
         pass
Ejemplo n.º 2
0
 def test_alcohol_majoration(self):
     """ Testing alcohol majoration
     """
     api.categories.set_alcoholic(self.cat_eat, True)
     pid = api.products.add("Lapin", category_id=self.cat_eat)
     desc_id = api.prices.add_descriptor("Unité", self.cat_eat, 100)
     settings.ALCOHOL_MAJORATION = 0.0
     settings.refresh_cache()
     self.assertEqual(list(api.prices.get()), [{
         'label': 'Unité',
         'id': 1,
         'product': 1,
         'category': 1,
         'value': 0.0,
         'alcoholic': True
     }])
     settings.ALCOHOL_MAJORATION = 5.0
     settings.refresh_cache()
     self.assertEqual(list(api.prices.get()), [{
         'label': 'Unité',
         'id': 1,
         'product': 1,
         'category': 1,
         'value': 5.0,
         'alcoholic': True
     }])
     settings.ALCOHOL_MAJORATION = 0.0
     settings.refresh_cache()
Ejemplo n.º 3
0
 def test_alcohol_majoration(self):
     """ Testing alcohol majoration
     """
     api.categories.set_alcoholic(self.cat_eat, True)
     pid = api.products.add("Lapin", category_id=self.cat_eat)
     desc_id = api.prices.add_descriptor("Unité", self.cat_eat, 100)
     settings.ALCOHOL_MAJORATION = 0.0
     settings.refresh_cache()
     self.assertEqual(list(api.prices.get()), [{'label': 'Unité', 'id': 1, 'product': 1, 'category': 1, 'value': 0.0, 'alcoholic': True}])
     settings.ALCOHOL_MAJORATION = 5.0
     settings.refresh_cache()
     self.assertEqual(list(api.prices.get()), [{'label': 'Unité', 'id': 1, 'product': 1, 'category': 1, 'value': 5.0, 'alcoholic': True}])
     settings.ALCOHOL_MAJORATION = 0.0
     settings.refresh_cache()
Ejemplo n.º 4
0
 def callback():
     settings.refresh_cache()
     self.assertEqual(settings.ALCOHOL_MAJORATION, 4.0)
     self.app.exit()
Ejemplo n.º 5
0
 def setUp(self):
     super().setUp()
     settings.ALCOHOL_MAJORATION = 0
     settings.refresh_cache()
     self.win = gui.settings_window.SettingsWindow()
Ejemplo n.º 6
0
 def setUp(self):
     super().setUp()
     settings.AUTH_SDE_TOKEN = ""
     settings.ALCOHOL_MAJORATION = 0
     settings.refresh_cache()