Instantly share code, notes, and snippets.

Embed
What would you like to do?
We have failing tests.
python manage.py test
.............FF.......
======================================================================
FAIL: test_api_should_have_tire_after_service_is_added (eneos.apps.recommendations.tests.RecommendationAPITest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/buddy/eneos-pos-web/eneos/apps/recommendations/tests.py", line 32, in test_api_should_have_tire_after_service_is_added
response = self.client.get(reverse_lazy('api:recommendation-list'))
File "/usr/local/lib/python3.6/site-packages/rest_framework/test.py", line 282, in get
response = super(APIClient, self).get(path, data=data, **extra)
File "/usr/local/lib/python3.6/site-packages/rest_framework/test.py", line 208, in get
return self.generic('GET', path, **r)
File "/usr/local/lib/python3.6/site-packages/django/test/client.py", line 409, in generic
return self.request(**r)
File "/usr/local/lib/python3.6/site-packages/rest_framework/test.py", line 279, in request
return super(APIClient, self).request(**kwargs)
File "/usr/local/lib/python3.6/site-packages/rest_framework/test.py", line 231, in request
request = super(APIRequestFactory, self).request(**kwargs)
File "/usr/local/lib/python3.6/site-packages/django/test/client.py", line 494, in request
six.reraise(*exc_info)
File "/usr/local/lib/python3.6/site-packages/django/utils/six.py", line 686, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 42, in inner
response = get_response(request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.6/contextlib.py", line 53, in inner
return func(*args, **kwds)
File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/rest_framework/viewsets.py", line 83, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/rest_framework/views.py", line 483, in dispatch
response = self.handle_exception(exc)
File "/usr/local/lib/python3.6/site-packages/rest_framework/views.py", line 443, in handle_exception
self.raise_uncaught_exception(exc)
File "/usr/local/lib/python3.6/site-packages/rest_framework/views.py", line 480, in dispatch
response = handler(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/rest_framework/mixins.py", line 45, in list
return self.get_paginated_response(serializer.data)
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 729, in data
ret = super(ListSerializer, self).data
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 262, in data
self._data = self.to_representation(self.instance)
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 647, in to_representation
self.child.to_representation(item) for item in iterable
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 647, in <listcomp>
self.child.to_representation(item) for item in iterable
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 483, in to_representation
fields = self._readable_fields
File "/usr/local/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 377, in _readable_fields
field for field in self.fields.values()
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 363, in fields
for key, value in self.get_fields().items():
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 984, in get_fields
field_names = self.get_field_names(declared_fields, info)
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 1097, in get_field_names
serializer_class=self.__class__.__name__
AssertionError: The field 'created_user' was included on serializer RecommendationSerializer in the 'exclude' option, but does not match any model field.
======================================================================
FAIL: test_api_should_only_have_oil_and_battery (eneos.apps.recommendations.tests.RecommendationAPITest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/buddy/eneos-pos-web/eneos/apps/recommendations/tests.py", line 25, in test_api_should_only_have_oil_and_battery
response = self.client.get(reverse_lazy('api:recommendation-list'))
File "/usr/local/lib/python3.6/site-packages/rest_framework/test.py", line 282, in get
response = super(APIClient, self).get(path, data=data, **extra)
File "/usr/local/lib/python3.6/site-packages/rest_framework/test.py", line 208, in get
return self.generic('GET', path, **r)
File "/usr/local/lib/python3.6/site-packages/django/test/client.py", line 409, in generic
return self.request(**r)
File "/usr/local/lib/python3.6/site-packages/rest_framework/test.py", line 279, in request
return super(APIClient, self).request(**kwargs)
File "/usr/local/lib/python3.6/site-packages/rest_framework/test.py", line 231, in request
request = super(APIRequestFactory, self).request(**kwargs)
File "/usr/local/lib/python3.6/site-packages/django/test/client.py", line 494, in request
six.reraise(*exc_info)
File "/usr/local/lib/python3.6/site-packages/django/utils/six.py", line 686, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/exception.py", line 42, in inner
response = get_response(request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python3.6/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python3.6/contextlib.py", line 53, in inner
return func(*args, **kwds)
File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
return view_func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/rest_framework/viewsets.py", line 83, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/rest_framework/views.py", line 483, in dispatch
response = self.handle_exception(exc)
File "/usr/local/lib/python3.6/site-packages/rest_framework/views.py", line 443, in handle_exception
self.raise_uncaught_exception(exc)
File "/usr/local/lib/python3.6/site-packages/rest_framework/views.py", line 480, in dispatch
response = handler(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/rest_framework/mixins.py", line 45, in list
return self.get_paginated_response(serializer.data)
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 729, in data
ret = super(ListSerializer, self).data
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 262, in data
self._data = self.to_representation(self.instance)
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 647, in to_representation
self.child.to_representation(item) for item in iterable
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 647, in <listcomp>
self.child.to_representation(item) for item in iterable
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 483, in to_representation
fields = self._readable_fields
File "/usr/local/lib/python3.6/site-packages/django/utils/functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 377, in _readable_fields
field for field in self.fields.values()
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 363, in fields
for key, value in self.get_fields().items():
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 984, in get_fields
field_names = self.get_field_names(declared_fields, info)
File "/usr/local/lib/python3.6/site-packages/rest_framework/serializers.py", line 1097, in get_field_names
serializer_class=self.__class__.__name__
AssertionError: The field 'created_user' was included on serializer RecommendationSerializer in the 'exclude' option, but does not match any model field.
Creating test database for alias 'default'...
Destroying test database for alias 'default'...
----------------------------------------------------------------------
Ran 22 tests in 1.553s
FAILED (failures=2)
FAILEDBuild failed !!!.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment