@@ -48,8 +48,9 @@ class Box(object):
4848 """
4949 API_PORT = 8086
5050 UPLOAD_PORT = 8087
51- OAUTH_PORT = 8088
51+ OAUTH_API_PORT = 8088
5252 EVENT_PORT = 8089
53+ OAUTH_AUTHORIZE_PORT = 8090
5354 RATE_LIMIT_THRESHOLD = 100
5455 RATE_LIMIT_REQUEST_PER_SECOND = 4
5556
@@ -60,12 +61,13 @@ def __init__(self):
6061 self ._db_session_maker = None
6162 self .reset_filesystem ()
6263 # Mock Box consists of 3 webservers - one for the content API, one for the upload API, and one for OAuth2
63- api , upload , oauth , event = Bottle (), Bottle (), Bottle (), Bottle ()
64+ api , upload , oauth_api , event , oauth_authorize = Bottle (), Bottle (), Bottle (), Bottle (), Bottle ()
6465 app_mapping = {
6566 self .API_PORT : api ,
6667 self .EVENT_PORT : event ,
67- self .OAUTH_PORT : oauth ,
68+ self .OAUTH_API_PORT : oauth_api ,
6869 self .UPLOAD_PORT : upload ,
70+ self .OAUTH_AUTHORIZE_PORT : oauth_authorize ,
6971 }
7072 # Since we don't instantiate the servers until Box is instantiated, we have to apply the routes now
7173 for routed_method in (getattr (self , m ) for m in dir (self ) if hasattr (getattr (self , m ), 'route' )):
@@ -77,8 +79,9 @@ def __init__(self):
7779 app .error (code )(self .handle_error )
7880 self ._api = StoppableWSGIRefServer (host = 'localhost' , port = self .API_PORT ).run (api )
7981 self ._upload = StoppableWSGIRefServer (host = 'localhost' , port = self .UPLOAD_PORT ).run (upload )
80- self ._oauth = StoppableWSGIRefServer (host = 'localhost' , port = self .OAUTH_PORT ).run (oauth )
82+ self ._oauth_api = StoppableWSGIRefServer (host = 'localhost' , port = self .OAUTH_API_PORT ).run (oauth_api )
8183 self ._event = StoppableWSGIRefServer (host = 'localhost' , port = self .EVENT_PORT ).run (event )
84+ self ._oauth_authorize = StoppableWSGIRefServer (host = 'localhost' , port = self .OAUTH_AUTHORIZE_PORT ).run (oauth_authorize )
8285 self ._rate_limit_bucket = (self .RATE_LIMIT_THRESHOLD , datetime .utcnow ())
8386
8487 @staticmethod
@@ -90,10 +93,12 @@ def shutdown(self):
9093 """Shutdown the webservers and wait for them to exit."""
9194 self ._api .shutdown ()
9295 self ._upload .shutdown ()
93- self ._oauth .shutdown ()
96+ self ._oauth_api .shutdown ()
97+ self ._oauth_authorize .shutdown ()
9498 self ._api .wait ()
9599 self ._upload .wait ()
96- self ._oauth .wait ()
100+ self ._oauth_api .wait ()
101+ self ._oauth_authorize .wait ()
97102
98103 def reset_filesystem (self , users = (), applications = ()):
99104 """
@@ -175,20 +180,20 @@ def append_to_request_log(self):
175180
176181 @log_request
177182 @allow_chaos
178- @GET (OAUTH_PORT , '/authorize ' )
183+ @GET (OAUTH_AUTHORIZE_PORT , '/' )
179184 @view ('oauth2' )
180185 def oauth2_authorize (self ):
181186 return self ._oauth_behavior .oauth2_authorize ()
182187
183188 @log_request
184189 @allow_chaos
185- @POST (OAUTH_PORT , '/authorize ' )
190+ @POST (OAUTH_AUTHORIZE_PORT , '/' )
186191 def oauth2_finish_loop (self ):
187192 return self ._oauth_behavior .oauth2_finish_loop ()
188193
189194 @log_request
190195 @allow_chaos
191- @POST (OAUTH_PORT , '/token' )
196+ @POST (OAUTH_API_PORT , '/token' )
192197 def oauth2_token (self ):
193198 return self ._oauth_behavior .oauth2_token ()
194199
0 commit comments