Exemplo n.º 1
0
 def test_ConnectError_msg(self):
     self.dev = Device(host='1.1.1.1', user='******')
     obj = ConnectError(self.dev, msg='underlying exception info')
     self.assertEqual(obj.msg, 'underlying exception info')
     self.assertEqual(
         repr(obj),
         'ConnectError(host: 1.1.1.1, msg: underlying exception info)')
Exemplo n.º 2
0
 def test_ConnectError(self):
     self.dev = Device(host='1.1.1.1', user='******')
     obj = ConnectError(self.dev)
     self.assertEqual(obj.user, 'rick')
     self.assertEqual(obj.host, '1.1.1.1')
     self.assertEqual(obj.port, 830)
     self.assertEqual(repr(obj), 'ConnectError(1.1.1.1)')
Exemplo n.º 3
0
 def test_ConnectError(self):
     self.dev = Device(host="1.1.1.1", user="******")
     obj = ConnectError(self.dev)
     self.assertEqual(obj.user, "rick")
     self.assertEqual(obj.host, "1.1.1.1")
     self.assertEqual(obj.port, 830)
     self.assertEqual(repr(obj), "ConnectError(1.1.1.1)")
Exemplo n.º 4
0
 def test_ConnectError_msg(self):
     self.dev = Device(host="1.1.1.1", user="******")
     obj = ConnectError(self.dev, msg="underlying exception info")
     self.assertEqual(obj.msg, "underlying exception info")
     self.assertEqual(
         repr(obj),
         "ConnectError(host: 1.1.1.1, msg: underlying exception info)")
Exemplo n.º 5
0
def test_get_dev_exception(monkeypatch):
    fake_device = mock.MagicMock(spec_set=device_connect.Device)
    fake_device.return_value.open.side_effect = ConnectError(fake_device, msg="fake_exception_message")

    monkeypatch.setattr(device_connect, 'Device', fake_device)

    return_value = device_facts()
    assert "ConnectError" in return_value
Exemplo n.º 6
0
 def test_ConnectError(self):
     self.dev = Device(host='1.1.1.1',
                       user='******',
                       password='******',
                       gather_facts=False)
     obj = ConnectError(self.dev)
     self.assertEqual(obj.user, 'rick')
     self.assertEqual(obj.host, '1.1.1.1')
     self.assertEqual(obj.port, 830)
     self.assertEqual(repr(obj), 'ConnectError(1.1.1.1)')