示例#1
0
def _create_version_table(screen):
    """Creates and adds a versions table and a viewless help table to the screen."""
    screen.add_table(Table(VersionScreen.APP_VERSIONS_TABLE_NAME, columns=[
        Column('#', None, 'DeployNum', 'left'),
        Column('Version Label', None, 'VersionLabel', 'left'),
        Column('Date Created', None, 'DateCreated', 'left'),
        Column('Age', None, 'SinceCreated', 'left'),
        Column('Description', None, 'Description', 'left'),
    ]))
    screen.add_help_table(ViewlessHelpTable())
示例#2
0
def _create_environment_table(screen):
    """Creates and adds a versions table and a viewless help table to the screen."""
    screen.add_table(Table('environments', columns=[
        Column('#', None, 'DeployNum', 'left'),
        Column('Name', None, 'EnvironmentName', 'left'),
        Column('ID', None, 'EnvironmentId', 'left'),
        Column('Application Version', None, 'VersionLabel', 'left'),
        Column('Date Terminated', None, 'DateUpdated', 'left'),
        Column('Ago', None, 'SinceCreated', 'left'),
    ]))
    screen.add_help_table(ViewlessHelpTable())
    def test_ascii_string__successfully_wraps_datetime(self):
        expected_datetime = datetime.datetime(2007, 12, 6, 16, 29, 43, 79043)
        wrapped_date_time = Table('my_table').ascii_string(expected_datetime)

        self.assertEqual('2007-12-06 16:29:43.079043', wrapped_date_time)
        self.assertEqual(26, len(wrapped_date_time))
    def test_ascii_string__successfully_wraps_number(self):
        number = 100
        wrapped_number = Table('my_table').ascii_string(number)

        self.assertEqual('100', wrapped_number)
        self.assertEqual(3, len(wrapped_number))
    def test_ascii_string__successfully_wraps_ascii_string(self):
        original_ascii_string = 'Hello, world!'
        wrapped_ascii_string = Table('my_table').ascii_string(original_ascii_string)

        self.assertEqual('Hello, world!', wrapped_ascii_string)
        self.assertEqual(13, len(wrapped_ascii_string))
    def test_ascii_string__successfully_wraps_utf8_string(self):
        original_utf8_string = u'The m\u0192\u2202\u0153\u2211\u0153\u2211\xae\xae\xae'
        wrapped_ascii_string = Table('my_table').ascii_string(original_utf8_string)

        self.assertEqual(original_utf8_string, wrapped_ascii_string)
        self.assertEqual(14, len(wrapped_ascii_string))