예제 #1
0
def test_create_from_financing_json(session):
    """Assert that the financing statement json renders to a list of vehicle collateral models correctly."""
    json_data = copy.deepcopy(FINANCING_STATEMENT)
    collateral = VehicleCollateral.create_from_financing_json(json_data, 12345)
    assert collateral
    assert len(collateral) == 1
    for c in collateral:
        assert c.registration_id == 12345
        assert c.vehicle_type
        assert c.serial_number
예제 #2
0
def test_find_by_registration_id(session):
    """Assert that find vehicle collateral by registration ID contains all expected elements."""
    collateral = VehicleCollateral.find_by_registration_id(200000000)
    assert collateral
    assert len(collateral) == 2
    assert collateral[0].id
    assert collateral[0].registration_id
    assert collateral[0].vehicle_type
    assert collateral[1].id
    assert collateral[1].registration_id
    assert collateral[1].vehicle_type == 'MH'
    assert collateral[1].mhr_number
예제 #3
0
def test_create_from_statement_json(session):
    """Assert that the financing statement json renders to a list of vehicle collateral models correctly."""
    json_data = copy.deepcopy(AMENDMENT_STATEMENT)
    collateral = VehicleCollateral.create_from_statement_json(
        json_data, 11111, 22222)
    assert collateral
    assert len(collateral) >= 1
    for c in collateral:
        assert c.registration_id == 11111
        assert c.financing_id == 22222
        assert c.vehicle_type
        assert c.serial_number
예제 #4
0
def test_find_by_id(session):
    """Assert that find vehicle collateral by vehicle collateral ID contains all expected elements."""
    collateral = VehicleCollateral.find_by_id(200000000)
    assert collateral
    assert collateral.id == 200000000
    assert collateral.registration_id == 200000000
    assert collateral.financing_id == 200000000
    assert collateral.vehicle_type == 'MV'
    assert collateral.make
    assert collateral.model
    assert collateral.serial_number
    assert not collateral.registration_id_end
    assert not collateral.mhr_number
예제 #5
0
def test_find_by_financing_id(session):
    """Assert that find vehicle collateral by financing statement ID contains all expected elements."""
    collateral = VehicleCollateral.find_by_financing_id(200000000)
    assert collateral
    assert len(collateral) >= 2
    assert collateral[0].id == 200000000
    assert collateral[0].registration_id == 200000000
    assert collateral[0].financing_id == 200000000
    assert not collateral[0].registration_id_end
    assert not collateral[0].mhr_number
    assert collateral[0].vehicle_type
    assert collateral[1].id
    assert collateral[1].registration_id
    assert collateral[1].vehicle_type == 'MH'
    assert collateral[1].mhr_number
예제 #6
0
def test_create_from_json(session):
    """Assert that the vehicle collateral json renders to a vehicle collateral model correctly."""
    json_data = {
        'type': 'MH',
        'year': 2004,
        'make': 'MAKE',
        'model': 'MODEL',
        'serialNumber': 'SERIAL',
        'manufacturedHomeRegistrationNumber': '123456'
    }

    collateral = VehicleCollateral.create_from_json(json_data, 12345)
    assert collateral
    assert collateral.registration_id == 12345
    assert collateral.vehicle_type == 'MH'
    assert collateral.serial_number == 'SERIAL'
    assert collateral.year == 2004
    assert collateral.make == 'MAKE'
    assert collateral.model == 'MODEL'
    assert collateral.mhr_number == '123456'
예제 #7
0
def test_vehicle_collateral_json(session):
    """Assert that the general collateral model renders to a json format correctly."""
    collateral = VehicleCollateral(id=1000,
                                   vehicle_type='MV',
                                   year=2004,
                                   make='MAKE',
                                   model='MODEL',
                                   serial_number='SERIAL_NUMBER',
                                   mhr_number='MHR_NUMBER')

    collateral_json = {
        'vehicleId': collateral.id,
        'type': collateral.vehicle_type,
        'year': collateral.year,
        'make': collateral.make,
        'model': collateral.model,
        'serialNumber': collateral.serial_number,
        'manufacturedHomeRegistrationNumber': collateral.mhr_number
    }

    assert collateral.json == collateral_json
예제 #8
0
def test_find_by_reg_id_invalid(session):
    """Assert that find vehicle collateral by non-existent registration ID returns the expected result."""
    collateral = VehicleCollateral.find_by_registration_id(300000000)
    assert not collateral
예제 #9
0
def test_find_by_financing_id_invalid(session):
    """Assert that find vehicle collateral by non-existent financing statement ID returns the expected result."""
    collateral = VehicleCollateral.find_by_financing_id(300000000)
    assert not collateral