Exemplo n.º 1
0
    def test_unixhost_get_model_failure(self):
        uobject = MagicMock(spec=UnixHost)
        uobject.name = 'foo'
        uobject.channels = []

        # Exception
        uobject.shell.side_effect = Exception
        try:
            UnixHost.get_model(uobject)
        except Exception as exp:
            self.assertEqual(exp.args[0], "Could not get model info")
Exemplo n.º 2
0
    def test_unixhost_get_model(self):
        uobject = MagicMock(spec=UnixHost)

        uobject.shell.return_value.response.return_value = " test"
        self.assertIsNone(UnixHost.get_model(uobject))

        uobject.shell.return_value.response.return_value = "mx480"
        self.assertEqual(UnixHost.get_model(uobject), "mx480")

        uobject.model = "mx2020"
        self.assertEqual(UnixHost.get_model(uobject), "mx2020")