forked from snowflakedb/snowflake-connector-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_network.py
More file actions
40 lines (36 loc) · 1.02 KB
/
test_network.py
File metadata and controls
40 lines (36 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2012-2018 Snowflake Computing Inc. All right reserved.
#
from logging import getLogger
logger = getLogger(__name__)
from snowflake.connector.network import SnowflakeRestful
from snowflake.connector import errors
from snowflake.connector import errorcode
def test_no_auth(db_parameters):
"""
SNOW-13588: No auth Rest API test
"""
rest = SnowflakeRestful(
host=db_parameters['host'],
port=db_parameters['port'])
try:
# no auth
# show warehouse
rest.request(
url='/queries',
body={
'sequenceId': 10000,
'sqlText': 'show warehouses',
'parameters': {
'ui_mode': True,
},
},
method='post',
client='rest')
raise Exception("Must fail with auth error")
except errors.Error as e:
assert e.errno == errorcode.ER_CONNECTION_IS_CLOSED
finally:
rest.close()