# Path: APITaxi_models2/unittest/factories.py
# class DepartementFactory(BaseFactory):
#     class Meta:
#         model = Departement
#         sqlalchemy_get_or_create = ['numero']
# 
#     nom = factory.Sequence(lambda n: 'DEPARTEMENT_%d' % n)
#     numero = factory.Sequence(lambda n: '%d' % n)
# 
# class DriverFactory(BaseFactory):
#     class Meta:
#         model = Driver
# 
#     last_name = factory.Sequence(lambda n: 'Dupont %d' % n)
#     first_name = 'Jean'
#     birth_date = datetime.date(1978, 1, 11)
#     professional_licence = factory.Sequence(lambda n: 'LICENCE_PRO_%d' % n)
#     departement = factory.SubFactory(DepartementFactory)
#     added_via = 'api'
#     source = 'added_by'


from unittest import mock
from APITaxi_models2 import db, Driver
from APITaxi_models2.unittest.factories import DepartementFactory, DriverFactory
import psycopg2.errors




class TestDriversCreate:
    def test_invalid(self, anonymous, moteur, operateur):
        # Login required
        resp = anonymous.client.post('/drivers', json={})
        assert resp.status_code == 401

        # Permission denied
        resp = moteur.client.post('/drivers', json={})
        assert resp.status_code == 403

        # Permissions OK, check required fields
        resp = operateur.client.post('/drivers', json={'data': [{

# Path: APITaxi_models2/unittest/factories.py
# class DepartementFactory(BaseFactory):
#     class Meta:
#         model = Departement
#         sqlalchemy_get_or_create = ['numero']
# 
#     nom = factory.Sequence(lambda n: 'DEPARTEMENT_%d' % n)
#     numero = factory.Sequence(lambda n: '%d' % n)
# 
# class DriverFactory(BaseFactory):
#     class Meta:
#         model = Driver
# 
#     last_name = factory.Sequence(lambda n: 'Dupont %d' % n)
#     first_name = 'Jean'
#     birth_date = datetime.date(1978, 1, 11)
#     professional_licence = factory.Sequence(lambda n: 'LICENCE_PRO_%d' % n)
#     departement = factory.SubFactory(DepartementFactory)
#     added_via = 'api'
#     source = 'added_by'


# Path: APITaxi2/tests/test_drivers.py
from unittest import mock
from APITaxi_models2 import db, Driver
from APITaxi_models2.unittest.factories import DepartementFactory, DriverFactory
import psycopg2.errors





class TestDriversCreate:
    def test_invalid(self, anonymous, moteur, operateur):
        # Login required
        resp = anonymous.client.post('/drivers', json={})
        assert resp.status_code == 401

        # Permission denied
        resp = moteur.client.post('/drivers', json={})
        assert resp.status_code == 403

        # Permissions OK, check required fields
        resp = operateur.client.post('/drivers', json={'data': [{

        }]})