mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-11 09:27:56 -04:00
more tests
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from app.history_meta import _get_bases_for_versioned_class
|
||||
from app.history_meta import (
|
||||
_get_bases_for_versioned_class,
|
||||
_handle_single_table_inheritance,
|
||||
)
|
||||
|
||||
|
||||
def test_get_bases_with_super_history_and_table():
|
||||
@@ -55,3 +58,27 @@ def test_get_bases_without_super_history():
|
||||
|
||||
assert bases == (Base,)
|
||||
assert "changed" not in properties
|
||||
|
||||
|
||||
def _col_copy(col):
|
||||
return f"copied_{col.key}"
|
||||
|
||||
|
||||
def test_handle_single_table_inheritance():
|
||||
col1 = MagicMock()
|
||||
col1.key = "id"
|
||||
col2 = MagicMock()
|
||||
col2.key = "new_column"
|
||||
|
||||
local_mapper = MagicMock()
|
||||
local_mapper.local_table.c = [col1, col2]
|
||||
|
||||
super_history_mapper = MagicMock()
|
||||
super_history_mapper.local_table.c = {"id": col1}
|
||||
super_history_mapper.local_table.append_column = MagicMock()
|
||||
|
||||
_handle_single_table_inheritance(local_mapper, super_history_mapper)
|
||||
|
||||
super_history_mapper.local_table.append_column.assert_called_once_with(
|
||||
"copied_new_column"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user