Ejemplo n.º 1
0
    def test_is_machine_connected_callback_error(self):
        """Test bad argument to is_machine_connected's internal callback.

        Passing anything other than ONLINE/OFFLINE/UNKNOWN should
        cause an exception.
        """
        self.patch(FakeNetworkManagerState, "connection_state",
                   NM_STATE_CONNECTED_GLOBAL)
        yield self.assertFailure(is_machine_connected(), NetworkFailException)
Ejemplo n.º 2
0
 def test_is_machine_connected_nm_state_unknown(self):
     """Callback given ONLINE should mean we are not online"""
     self.patch(FakeNetworkManagerState, "connection_state",
                UNKNOWN)
     d = yield is_machine_connected()
     self.assertFalse(d)
Ejemplo n.º 3
0
 def test_is_machine_connected_nm_state_offline(self):
     """Callback given OFFLINE should mean we are offline"""
     self.patch(FakeNetworkManagerState, "connection_state",
                OFFLINE)
     d = yield is_machine_connected()
     self.assertFalse(d)