def test_miner_no_update(self): miner = Miner('test') miner.ipaddress = 'ip1' minerupdate = Miner('test') minerupdate.ipaddress = None miner.updatefrom(minerupdate) self.assertTrue(miner.ipaddress != minerupdate.ipaddress)
def test_miner_can_monitor(self): miner = Miner("test", '', '', '', '', '', '', '', '') self.assertFalse(miner.can_monitor()) miner.ipaddress = '123.123.123.123' self.assertFalse(miner.can_monitor()) miner.port = '4028' self.assertTrue(miner.can_monitor())
def test_miner_update(self): miner = Miner('test') miner.minerid = 'test' miner.ipaddress = 'ip1' miner.location = 'location1' miner.in_service_date = datetime.datetime.now().replace(second=0, microsecond=0) minerupdate = Miner('test1') minerupdate.minerid = 'test1' minerupdate.ipaddress = 'ip2' minerupdate.location = 'location2' minerupdate.in_service_date = datetime.datetime.now() miner.updatefrom(minerupdate) self.assertFalse(miner.ipaddress == minerupdate.ipaddress) minerupdate.minerid = miner.minerid miner.updatefrom(minerupdate) self.assertTrue(miner.ipaddress == minerupdate.ipaddress) self.assertTrue(miner.location == minerupdate.location) self.assertTrue(miner.in_service_date == minerupdate.in_service_date)