1717from minfraud .models import Factors , Insights , Score
1818from minfraud .webservice import AsyncClient , Client
1919
20+ import minfraud .webservice
2021import unittest
2122
23+ minfraud .webservice ._SCHEME = "http"
2224
2325class BaseTest (unittest .TestCase ):
2426 client_class : Union [Type [AsyncClient ], Type [Client ]] = Client
@@ -28,16 +30,7 @@ def setup_httpserver(self, httpserver: HTTPServer):
2830 self .httpserver = httpserver
2931
3032 def setUp (self ):
31- self .client = self .client_class (42 , "abcdef123456" )
32- self .client ._base_uri = self .httpserver .url_for ("/minfraud/v2.0" )
33- self .client ._factors_uri = self .httpserver .url_for ("/minfraud/v2.0/factors" )
34-
35- self .client ._insights_uri = self .httpserver .url_for ("/minfraud/v2.0/insights" )
36- self .client ._score_uri = self .httpserver .url_for ("/minfraud/v2.0/score" )
37- self .client ._report_uri = self .httpserver .url_for (
38- "/minfraud/v2.0/transactions/report"
39- )
40-
33+ self .client = self .client_class (42 , "abcdef123456" ,host = "{0}:{1}" .format (self .httpserver .host ,self .httpserver .port ))
4134 test_dir = os .path .join (os .path .dirname (__file__ ), "data" )
4235 with open (os .path .join (test_dir , self .request_file ), encoding = "utf-8" ) as file :
4336 content = file .read ()
@@ -241,14 +234,7 @@ def custom_handler(r):
241234
242235 def test_200_with_locales (self ):
243236 locales = ("fr" ,)
244- client = self .client_class (42 , "abcdef123456" , locales = locales )
245- client ._base_uri = self .httpserver .url_for ("/minfraud/v2.0" )
246- client ._factors_uri = self .httpserver .url_for ("/minfraud/v2.0/factors" )
247- client ._insights_uri = self .httpserver .url_for ("/minfraud/v2.0/insights" )
248- client ._score_uri = self .httpserver .url_for ("/minfraud/v2.0/score" )
249- client ._report_uri = self .httpserver .url_for (
250- "minfraud/v2.0/transactions/report"
251- )
237+ client = self .client_class (42 , "abcdef123456" , locales = locales ,host = "{0}:{1}" .format (self .httpserver .host ,self .httpserver .port ))
252238 model = self .create_success (client = client )
253239 response = json .loads (self .response )
254240 if self .has_ip_location ():
0 commit comments