Esempio n. 1
0
    def test_host(self):
        """ Unittest for the host property. """
        c = Connection()

        # first, let the connection figure out the hot IP by itself
        global MOCK_sercmd_ret
        MOCK_sercmd_ret = "534.117.9.15"
        self.assertEquals(c.host, MOCK_sercmd_ret)

        # then, check whether we can set it
        c.host = "www.heise.de"
        self.assertEquals(c.host, "www.heise.de")

        # finally: check the deleter and the getter's exception handling
        del c.host
        MOCK_sercmd_ret = "unparseable IP address"
        self.assertRaises(Exception, lambda: c.host)
        del c.host