File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed
Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change 99
1010import pandas as pd
1111import pytest
12+ import requests
1213from windpowerlib .data import (
1314 check_data_integrity ,
1415 check_turbine_data ,
@@ -101,6 +102,23 @@ def test_wrong_url_load_turbine_data(self):
101102 ):
102103 store_turbine_data_from_oedb ("wrong_schema" )
103104
105+ def test_wrong_ssl_connection (self ):
106+ """Test failing ssl connection. To avoid this error in data.py the in
107+ the function fetch_turbine_data_from_oedb in data.py verify was set
108+ to False to ignore the exception in the requests statement.
109+
110+ If this test fails you can set verify to True and remove this test if
111+ all the other tests work fine.
112+ """
113+ schema = "supply"
114+ table = "wind_turbine_library"
115+ oep_url = "https://oep.iks.cs.ovgu.de/"
116+ url = oep_url + "/api/v0/schema/{}/tables/{}/rows/?" .format (
117+ schema , table
118+ )
119+ with pytest .raises (requests .exceptions .SSLError ):
120+ requests .get (url , verify = True )
121+
104122 def test_restore_default_data (self ):
105123 """Test the clean recovery of the data files."""
106124 names = ["turbine_data" , "power_curves" , "power_coefficient_curves" ]
Original file line number Diff line number Diff line change @@ -133,11 +133,11 @@ def fetch_turbine_data_from_oedb(
133133
134134 """
135135 # url of OpenEnergy Platform that contains the oedb
136- oep_url = "http ://oep.iks.cs.ovgu.de/"
136+ oep_url = "https ://oep.iks.cs.ovgu.de/"
137137 url = oep_url + "/api/v0/schema/{}/tables/{}/rows/?" .format (schema , table )
138138
139139 # load data
140- result = requests .get (url )
140+ result = requests .get (url , verify = False )
141141 if not result .status_code == 200 :
142142 raise ConnectionError (
143143 "Database (oep) connection not successful. \n URL: {2}\n "
You can’t perform that action at this time.
0 commit comments