Пример #1
0
def test_director_save(session):
    """Assert that the director saves correctly."""
    director = Director(first_name='Michael',
                        last_name='Crane',
                        middle_initial='Joe',
                        title='VP',
                        appointment_date=datetime.datetime(2017, 5, 17),
                        cessation_date=None)

    director.save()
    assert director.id
Пример #2
0
def create_director(director):
    """Create a director."""
    from legal_api.models import Address, Director
    new_address = Address(
        street=director['deliveryAddress']['streetAddress'],
        city=director['deliveryAddress']['addressCity'],
        country='CA',
        postal_code=director['deliveryAddress']['postalCode'],
        region=director['deliveryAddress']['addressRegion'],
        delivery_instructions=director['deliveryAddress'].get(
            'deliveryInstructions', '').upper())
    new_address.save()
    new_director = Director(
        first_name=director['officer'].get('firstName', '').upper(),
        last_name=director['officer'].get('lastName', '').upper(),
        middle_initial=director['officer'].get('middleInitial', '').upper(),
        appointment_date=director['appointmentDate'],
        cessation_date=None,
        delivery_address=new_address)
    new_director.save()
    return new_director