|
|
@@ -200,6 +200,21 @@ class TestApi(object):
|
|
|
[{'name': 'col1', 'type': 'STRING_TYPE', 'comment': ''}]
|
|
|
)
|
|
|
|
|
|
+ def test_get_sample_data_table(self):
|
|
|
+ snippet = Mock()
|
|
|
+
|
|
|
+ with patch('notebook.connectors.sql_alchemy.Assist.get_sample_data') as get_sample_data:
|
|
|
+ with patch('notebook.connectors.sql_alchemy.inspect') as inspect:
|
|
|
+ get_sample_data.return_value = (['col1'], [[1], [2]])
|
|
|
+
|
|
|
+ response = SqlAlchemyApi(self.user, self.interpreter).get_sample_data(snippet, table='table1')
|
|
|
+
|
|
|
+ assert_equal(response['rows'], [[1], [2]])
|
|
|
+ assert_equal(
|
|
|
+ response['full_headers'],
|
|
|
+ [{'name': 'col1', 'type': 'STRING_TYPE', 'comment': ''}]
|
|
|
+ )
|
|
|
+
|
|
|
|
|
|
class TestDialects(object):
|
|
|
|