Ejemplo n.º 1
0
    def test_find_index_with_not_found(self):
        """Testing DatabaseState.find_index with index no found"""
        database_state = DatabaseState(db_name='default', scan=False)
        database_state.add_table('my_test_table')

        index = database_state.find_index(table_name='my_test_table',
                                          columns=['col1', 'col2'],
                                          unique=True)
        self.assertIsNone(index)
    def test_find_index_with_not_found(self):
        """Testing DatabaseState.find_index with index no found"""
        database_state = DatabaseState(db_name='default', scan=False)
        database_state.add_table('my_test_table')

        index = database_state.find_index(table_name='my_test_table',
                                          columns=['col1', 'col2'],
                                          unique=True)
        self.assertIsNone(index)
Ejemplo n.º 3
0
    def test_find_index(self):
        """Testing DatabaseState.find_index"""
        database_state = DatabaseState(db_name='default', scan=False)
        database_state.add_table('my_test_table')
        database_state.add_index(table_name='my_test_table',
                                 index_name='my_index',
                                 columns=['col1', 'col2'])

        index = database_state.find_index(table_name='my_test_table',
                                          columns=['col1', 'col2'])
        self.assertEqual(index,
                         IndexState(name='my_index', columns=['col1', 'col2']))
Ejemplo n.º 4
0
    def test_find_index_with_unique_true(self):
        """Testing DatabaseState.find_index with unique=True"""
        database_state = DatabaseState(db_name='default', scan=False)
        database_state.add_table('my_test_table')
        database_state.add_index(table_name='my_test_table',
                                 index_name='my_index',
                                 columns=['col1', 'col2'],
                                 unique=True)

        index = database_state.find_index(table_name='my_test_table',
                                          columns=['col1', 'col2'],
                                          unique=True)
        self.assertEqual(
            index,
            IndexState(name='my_index', columns=['col1', 'col2'], unique=True))
    def test_find_index(self):
        """Testing DatabaseState.find_index"""
        database_state = DatabaseState(db_name='default', scan=False)
        database_state.add_table('my_test_table')
        database_state.add_index(table_name='my_test_table',
                                 index_name='my_index',
                                 columns=['col1', 'col2'],
                                 unique=True)

        index = database_state.find_index(table_name='my_test_table',
                                          columns=['col1', 'col2'],
                                          unique=True)
        self.assertEqual(index,
                         IndexState(name='my_index',
                                    columns=['col1', 'col2'],
                                    unique=True))