mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-11-04 01:47:36 +03:00 
			
		
		
		
	Revert the api_client miniapp accidental changes
This commit is contained in:
		
							parent
							
								
									083c050cd4
								
							
						
					
					
						commit
						5a4edd65b8
					
				| 
						 | 
				
			
			@ -7,7 +7,7 @@ import models
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
# Creating ApiClient and User providers:
 | 
			
		||||
api_client = providers.Singleton(api.Converter,
 | 
			
		||||
api_client = providers.Singleton(api.ApiClient,
 | 
			
		||||
                                 host='production.com',
 | 
			
		||||
                                 api_key='PROD_API_KEY')
 | 
			
		||||
user_factory = providers.Factory(models.User,
 | 
			
		||||
| 
						 | 
				
			
			@ -27,7 +27,7 @@ if __name__ == '__main__':
 | 
			
		|||
    # {'id': 2}
 | 
			
		||||
 | 
			
		||||
    # Overriding of ApiClient on dev environment:
 | 
			
		||||
    api_client.override(providers.Singleton(api.Converter,
 | 
			
		||||
    api_client.override(providers.Singleton(api.ApiClient,
 | 
			
		||||
                                            host='localhost',
 | 
			
		||||
                                            api_key='DEV_API_KEY'))
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import main
 | 
			
		|||
import api
 | 
			
		||||
 | 
			
		||||
# Mock ApiClient for testing:
 | 
			
		||||
with main.api_client.override(Mock(api.Converter)) as api_client_mock:
 | 
			
		||||
with main.api_client.override(Mock(api.ApiClient)) as api_client_mock:
 | 
			
		||||
    user = main.user_factory('test')
 | 
			
		||||
    user.register()
 | 
			
		||||
    api_client_mock().call.assert_called_with('register', {'id': 'test'})
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user