コード例 #1
0
    def __init__(self, column_name, column_type=None, default_value=None, **kwargs):
        self._mapping = {}  # Map for remembering old and ugly column names

        self.id = pep_up(column_name)  # Clean up the name
        self._mapping[self.id] = column_name  # Remember the name

        self.name = column_name
        self.type = int(column_type) if column_type else None
        self.default = default_value

        self.is_key = kwargs.get('is_key', False)
コード例 #2
0
def test_add_list_column_text(engage_api, test_database):
    COLUMN_NAME = 'My Text COLUMN'
    PEPED_COLUMN_NAME = pep_up(COLUMN_NAME)

    # Create column
    try:
        success = engage_api.add_list_column(
            settings.ENGAGE_DATABASE_ID, COLUMN_NAME, COLUMN_TYPE_TEXT, '')
        assert success is True
    except ColumnAlreadyExistsError:
        pass

    # Retrieve database's meta info
    success = engage_api.get_list_meta_data(test_database)
    assert success is True

    # Check for column
    table = test_database._table
    assert PEPED_COLUMN_NAME in table.column_names
    assert (table[PEPED_COLUMN_NAME]).type == COLUMN_TYPE_TEXT