Skip to content

Commit a3d2cc1

Browse files
author
Mmoncadaisla
committed
Add test to verify that create_table_from query performs cartodbfication
1 parent ddcbe1c commit a3d2cc1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/unit/io/managers/test_context_manager.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,3 +278,16 @@ def __init__(self):
278278

279279
with pytest.raises(CartoRateLimitException):
280280
test_function(retry_times=0)
281+
282+
def test_create_table_from_query_cartodbfy(self, mocker):
283+
# Given
284+
mocker.patch.object(ContextManager, 'has_table', return_value=False)
285+
mocker.patch.object(ContextManager, 'get_schema', return_value='schema')
286+
mock = mocker.patch.object(ContextManager, 'execute_long_running_query')
287+
288+
# When
289+
cm = ContextManager(self.credentials)
290+
cm.create_table_from_query('SELECT * FROM table_name', '__new_table_name__', if_exists='fail', cartodbfy=True)
291+
292+
# Then
293+
mock.assert_called_with("SELECT CDB_CartodbfyTable('schema', '__new_table_name__')")

0 commit comments

Comments
 (0)