Ejemplo n.º 1
0
 def test_add_device_context(self):
     """
     Ensure that adding a device context works
     """
     manager = SessionManager([], self.storage)
     manager.add_device_context(self.context)
     self.assertIn(self.context, manager.device_context_list)
Ejemplo n.º 2
0
 def test_on_device_context_added(self):
     """
     Ensure that adding a device context sends the appropriate signal
     """
     manager = SessionManager([], self.storage)
     self.watchSignal(manager.on_device_context_added)
     manager.add_device_context(self.context)
     self.assertSignalFired(manager.on_device_context_added, self.context)
Ejemplo n.º 3
0
 def test_add_device_context__twice(self):
     """
     Ensure that you cannot add the same device context twice
     """
     manager = SessionManager([], self.storage)
     manager.add_device_context(self.context)
     with self.assertRaises(ValueError):
         manager.add_device_context(self.context)
Ejemplo n.º 4
0
 def test_add_device_context__add_another(self):
     """
     Ensure that adding a second context also works
     """
     manager = SessionManager([], self.storage)
     manager.add_device_context(self.context)
     manager.add_device_context(self.context2)
     self.assertIn(self.context, manager.device_context_list)
     self.assertIn(self.context2, manager.device_context_list)