Esempio n. 1
0
def populate_ars(min_batch_size, batch_size):
    click.echo('- Adding ars data')
    batch = SPIREBatchFactory()
    country_group = SPIRECountryGroupFactory()
    SPIREIncidentFactory.create_batch(size=batch_size)
    goods_incidents = SPIREGoodsIncidentFactory.create_batch(
        size=min_batch_size, batch=batch)
    SPIREArsFactory.create_batch(size=batch_size,
                                 goods_incident__country_group=country_group)
    SPIRERefArsSubjectFactory.create_batch(size=batch_size)
    SPIREReasonForRefusalFactory.create_batch(
        size=batch_size, goods_incident=goods_incidents[0])
    SPIREControlEntryFactory.create_batch(size=batch_size)
def test_incident_check_constraint_13(app_with_db, other_flag, raise_exception):
    if raise_exception:
        with pytest.raises(raise_exception):
            SPIREIncidentFactory(other_flag=other_flag)
    else:
        SPIREIncidentFactory(other_flag=other_flag)
def test_incident_check_constraint_14(app_with_db, torture_flag, raise_exception):
    if raise_exception:
        with pytest.raises(raise_exception):
            SPIREIncidentFactory(torture_flag=torture_flag)
    else:
        SPIREIncidentFactory(torture_flag=torture_flag)
def test_incident_check_constraint_10(app_with_db, licence_conversion_flag, raise_exception):
    if raise_exception:
        with pytest.raises(raise_exception):
            SPIREIncidentFactory(licence_conversion_flag=licence_conversion_flag)
    else:
        SPIREIncidentFactory(licence_conversion_flag=licence_conversion_flag)
def test_incident_check_constraint_11(app_with_db, incorporation_flag, raise_exception):
    if raise_exception:
        with pytest.raises(raise_exception):
            SPIREIncidentFactory(incorporation_flag=incorporation_flag)
    else:
        SPIREIncidentFactory(incorporation_flag=incorporation_flag)
def test_incident_check_constraint_9(app_with_db, case_type, case_sub_type, raise_exception):
    if raise_exception:
        with pytest.raises(IntegrityError):
            SPIREIncidentFactory(case_type=case_type, case_sub_type=case_sub_type)
    else:
        SPIREIncidentFactory(case_type=case_type, case_sub_type=case_sub_type)
def test_incident_check_constraint_6(app_with_db, _type, else_id, raise_exception):
    if raise_exception:
        with pytest.raises(IntegrityError):
            SPIREIncidentFactory(type=_type, else_id=else_id)
    else:
        SPIREIncidentFactory(type=_type, else_id=else_id)
def test_incident_check_constraint_4(app_with_db, temporary_licence_flag, raise_exception):
    if raise_exception:
        with pytest.raises(raise_exception):
            SPIREIncidentFactory(temporary_licence_flag=temporary_licence_flag)
    else:
        SPIREIncidentFactory(temporary_licence_flag=temporary_licence_flag)
def test_incident_check_constraint_2(app_with_db, version_no, raise_exception):
    if raise_exception:
        with pytest.raises(raise_exception):
            SPIREIncidentFactory(version_no=version_no)
    else:
        SPIREIncidentFactory(version_no=version_no)
def test_incident_check_constraint_1(app_with_db, status, raise_exception):
    if raise_exception:
        with pytest.raises(IntegrityError):
            SPIREIncidentFactory(status=status)
    else:
        SPIREIncidentFactory(status=status)