def test_noChannelRendering(self): """ Verify that the status widget renders properly when there is no focused channel in its model. """ status = StatusWidget(DummyModel(None)) status.render(self.width, self.height, self.terminal) expected = '[%s] (No Channel)' % (version,) self.assertEqual(str(self.terminal), expected + ' ' * (self.width - len(expected)))
def test_withChannelRendering(self): """ Verify that the status widget renders properly when there is a focused channel in its model. """ channel = '#example' status = StatusWidget(DummyModel(channel)) status.render(self.width, self.height, self.terminal) expected = '[%s] %s' % (version, channel) self.assertEqual(str(self.terminal), expected + ' ' * (self.width - len(expected)))
def test_shortenedStatus(self): """ Verify that if a new status is shorter than the previous status, the previous status is completely erased. """ longChannel = '#long-channel-name' shortChannel = '#short' status = StatusWidget(DummyModel(longChannel)) status.render(self.width, self.height, self.terminal) status = StatusWidget(DummyModel(shortChannel)) status.render(self.width, self.height, self.terminal) expected = '[%s] %s' % (version, shortChannel) self.assertEqual(str(self.terminal), expected + ' ' * (self.width - len(expected)))