mirror of
				https://github.com/graphql-python/graphene-django.git
				synced 2025-10-31 16:07:36 +03:00 
			
		
		
		
	Rewrite unit test to make it working on all versions of django
This commit is contained in:
		
							parent
							
								
									a9f34dab93
								
							
						
					
					
						commit
						33b2b42e6f
					
				|  | @ -457,14 +457,18 @@ def test_handles_invalid_json_bodies(client): | |||
|     } | ||||
| 
 | ||||
| 
 | ||||
| def test_handles_django_request_error(client, settings): | ||||
|     settings.DATA_UPLOAD_MAX_MEMORY_SIZE = 1000 | ||||
|     valid_json = json.dumps(dict(test='x' * 1000)) | ||||
| def test_handles_django_request_error(client, monkeypatch): | ||||
|     def mocked_read(*args): | ||||
|         raise IOError("foo-bar") | ||||
| 
 | ||||
|     monkeypatch.setattr("django.http.request.HttpRequest.read", mocked_read) | ||||
| 
 | ||||
|     valid_json = json.dumps(dict(foo='bar')) | ||||
|     response = client.post(url_string(), valid_json, 'application/json') | ||||
| 
 | ||||
|     assert response.status_code == 400 | ||||
|     assert response_json(response) == { | ||||
|         'errors': [{'message': 'Request body exceeded settings.DATA_UPLOAD_MAX_MEMORY_SIZE.'}] | ||||
|         'errors': [{'message': 'foo-bar'}] | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user