# Path: APITaxi_models2/unittest/factories.py
# class UserFactory(BaseFactory):
#     class Meta:
#         model = User
#         sqlalchemy_get_or_create = ('email',)
# 
#     email = factory.Sequence(lambda n: 'test_user_%d' % n)
#     password = 'super_password'
#     active = True
#     confirmed_at = datetime.datetime(2015, 12, 1, 13, 37)
#     apikey = factory.Sequence(lambda n: 'API_KEY_%d' % n)


import apispec
from flask import abort
from flask_security import current_user, login_required, roles_accepted
from APITaxi_models2.unittest.factories import UserFactory
        # Edition request, but content-type not set. It is set by middleware.
        resp = getattr(anonymous.client, req)('/whatever')
        assert resp.status_code == 400
        assert 'content-type' not in resp.json['errors'][''][0].lower()

        # Edition request, content-type contains a charset.
        resp = getattr(anonymous.client, req)('/whatever', headers={
            'Content-Type': 'application/json; charset=utf-8'
        })
        assert resp.status_code == 400
        assert 'content-type' not in resp.json['errors'][''][0].lower()

        # Edition request, invalid content-type.
        resp = getattr(anonymous.client, req)('/whatever', headers={
            'Content-Type': 'text/html'
        })
        assert resp.status_code == 400
        assert 'content-type' in resp.json['errors'][''][0].lower()

        # Edition request, content-type OK but no data
        resp = getattr(anonymous.client, req)('/whatever', headers={
            'Content-Type': 'application/json'
        })
        assert resp.status_code == 400
        assert 'content-type' not in resp.json['errors'][''][0].lower()
        assert 'valid json' in resp.json['errors'][''][0].lower()

        # Edition request, content-type OK but data not valid JSON
        resp = getattr(anonymous.client, req)('/whatever', data='{{{{', headers={
            'Content-Type': 'application/json'

# Path: APITaxi_models2/unittest/factories.py
# class UserFactory(BaseFactory):
#     class Meta:
#         model = User
#         sqlalchemy_get_or_create = ('email',)
# 
#     email = factory.Sequence(lambda n: 'test_user_%d' % n)
#     password = 'super_password'
#     active = True
#     confirmed_at = datetime.datetime(2015, 12, 1, 13, 37)
#     apikey = factory.Sequence(lambda n: 'API_KEY_%d' % n)


# Path: APITaxi2/tests/test_api.py
import apispec
from flask import abort
from flask_security import current_user, login_required, roles_accepted
from APITaxi_models2.unittest.factories import UserFactory

        # Edition request, but content-type not set. It is set by middleware.
        resp = getattr(anonymous.client, req)('/whatever')
        assert resp.status_code == 400
        assert 'content-type' not in resp.json['errors'][''][0].lower()

        # Edition request, content-type contains a charset.
        resp = getattr(anonymous.client, req)('/whatever', headers={
            'Content-Type': 'application/json; charset=utf-8'
        })
        assert resp.status_code == 400
        assert 'content-type' not in resp.json['errors'][''][0].lower()

        # Edition request, invalid content-type.
        resp = getattr(anonymous.client, req)('/whatever', headers={
            'Content-Type': 'text/html'
        })
        assert resp.status_code == 400
        assert 'content-type' in resp.json['errors'][''][0].lower()

        # Edition request, content-type OK but no data
        resp = getattr(anonymous.client, req)('/whatever', headers={
            'Content-Type': 'application/json'
        })
        assert resp.status_code == 400
        assert 'content-type' not in resp.json['errors'][''][0].lower()
        assert 'valid json' in resp.json['errors'][''][0].lower()

        # Edition request, content-type OK but data not valid JSON
        resp = getattr(anonymous.client, req)('/whatever', data='{{{{', headers={
            'Content-Type': 'application/json'

        })