Beispiel #1
0
def test__dpd_checksum__create_checksum__pharmaceutical_standard(hc_dpd_original_pharmaceutical_standard):
    """Tests that checksum can be created from pharmaceutical standard model."""
    # Create initial checksum model
    checksum = models.DPDChecksum(
        drug_code_start=0,
        drug_code_step=100000,
        extract_source=utils.PHARMACEUTICAL_STANDARD
    )

    # Confirm no checksum details added yet
    assert checksum.checksum == ''

    # Call method to generate checksum data
    checksum.create_checksum()

    # Confirm checksum data now added
    assert checksum.checksum != ''

    # Create another pharmaceutical standard instance
    new_instance = models.OriginalPharmaceuticalStandard.objects.get(
        pk=hc_dpd_original_pharmaceutical_standard.pk
    )
    new_instance.pk = hc_dpd_original_pharmaceutical_standard.pk + 9999
    new_instance.save()

    # Confirm checksum has changed due to new data
    old_checksum = checksum.checksum
    checksum.create_checksum()

    assert checksum.checksum != ''
    assert checksum.checksum != old_checksum
Beispiel #2
0
def test__dpd_checksum__create_checksum__inactive_product(hc_dpd_original_inactive_product):
    """Tests that checksum can be created from inactive product model."""
    # Create initial checksum model
    checksum = models.DPDChecksum(
        drug_code_start=0,
        drug_code_step=100000,
        extract_source=utils.INACTIVE_PRODUCT
    )

    # Confirm no checksum details added yet
    assert checksum.checksum == ''

    # Call method to generate checksum data
    checksum.create_checksum()

    # Confirm checksum data now added
    assert checksum.checksum != ''

    # Create another inactive product instance
    new_instance = models.OriginalInactiveProduct.objects.get(
        pk=hc_dpd_original_inactive_product.pk
    )
    new_instance.pk = hc_dpd_original_inactive_product.pk + 9999
    new_instance.save()

    # Confirm checksum has changed due to new data
    old_checksum = checksum.checksum
    checksum.create_checksum()

    assert checksum.checksum != ''
    assert checksum.checksum != old_checksum
Beispiel #3
0
def test__dpd_checksum__create_checksum__packaging(hc_dpd_original_packaging):
    """Tests that checksum can be created from packaging model."""
    # Create initial checksum model
    checksum = models.DPDChecksum(
        drug_code_start=0,
        drug_code_step=100000,
        extract_source=utils.PACKAGING
    )

    # Confirm no checksum details added yet
    assert checksum.checksum == ''

    # Call method to generate checksum data
    checksum.create_checksum()

    # Confirm checksum data now added
    assert checksum.checksum != ''

    # Create another packaging instance
    new_instance = models.OriginalPackaging.objects.get(
        pk=hc_dpd_original_packaging.pk
    )
    new_instance.pk = hc_dpd_original_packaging.pk + 9999
    new_instance.save()

    # Confirm checksum has changed due to new data
    old_checksum = checksum.checksum
    checksum.create_checksum()

    assert checksum.checksum != ''
    assert checksum.checksum != old_checksum
Beispiel #4
0
def test__dpd_checksum__create_checksum__biosimilar(hc_dpd_original_biosimilar):
    """Tests that checksum can be created from biosimilar model."""
    # Create initial checksum model
    checksum = models.DPDChecksum(
        drug_code_start=0,
        drug_code_step=100000,
        extract_source=utils.BIOSIMILAR
    )

    # Confirm no checksum details added yet
    assert checksum.checksum == ''

    # Call method to generate checksum data
    checksum.create_checksum()

    # Confirm checksum data now added
    assert checksum.checksum != ''

    # Create another biosimilar instance
    new_instance = models.OriginalBiosimilar.objects.get(
        pk=hc_dpd_original_biosimilar.pk
    )
    new_instance.pk = hc_dpd_original_biosimilar.pk + 9999
    new_instance.save()

    # Confirm checksum has changed due to new data
    old_checksum = checksum.checksum
    checksum.create_checksum()

    assert checksum.checksum != ''
    assert checksum.checksum != old_checksum
Beispiel #5
0
def test__dpd_checksum__create_checksum__two_models(
    hc_dpd_original_biosimilar, hc_dpd_original_company
):  # pylint: disable=unused-argument
    """Tests that checksum only pulls data from expected model."""
    # Create initial checksum model
    checksum = models.DPDChecksum(
        drug_code_start=0,
        drug_code_step=100000,
        extract_source=utils.BIOSIMILAR
    )

    # Confirm no checksum details added yet
    assert checksum.checksum == ''

    # Call method to generate checksum data
    checksum.create_checksum()

    # Confirm checksum data now added
    assert checksum.checksum != ''

    # Create another company instance
    new_instance = models.OriginalCompany.objects.get(
        pk=hc_dpd_original_company.pk
    )
    new_instance.pk = hc_dpd_original_company.pk + 9999
    new_instance.save()

    # Confirm checksum has not changed due to new data
    old_checksum = checksum.checksum
    checksum.create_checksum()

    assert checksum.checksum != ''
    assert checksum.checksum == old_checksum
Beispiel #6
0
def test__dpd_checksum__create_checksum__veterinary_species(hc_dpd_original_veterinary_species):
    """Tests that checksum can be created from veterinary species model."""
    # Create initial checksum model
    checksum = models.DPDChecksum(
        drug_code_start=0,
        drug_code_step=100000,
        extract_source=utils.VETERINARY_SPECIES
    )

    # Confirm no checksum details added yet
    assert checksum.checksum == ''

    # Call method to generate checksum data
    checksum.create_checksum()

    # Confirm checksum data now added
    assert checksum.checksum != ''

    # Create another veterinary species instance
    new_instance = models.OriginalVeterinarySpecies.objects.get(
        pk=hc_dpd_original_veterinary_species.pk
    )
    new_instance.pk = hc_dpd_original_veterinary_species.pk + 9999
    new_instance.save()

    # Confirm checksum has changed due to new data
    old_checksum = checksum.checksum
    checksum.create_checksum()

    assert checksum.checksum != ''
    assert checksum.checksum != old_checksum
Beispiel #7
0
def test__dpd_checksum__create_checksum__therapeutic_class(hc_dpd_original_therapeutic_class):
    """Tests that checksum can be created from therapeutic class model."""
    # Create initial checksum model
    checksum = models.DPDChecksum(
        drug_code_start=0,
        drug_code_step=100000,
        extract_source=utils.THERAPUETIC_CLASS
    )

    # Confirm no checksum details added yet
    assert checksum.checksum == ''

    # Call method to generate checksum data
    checksum.create_checksum()

    # Confirm checksum data now added
    assert checksum.checksum != ''

    # Create another therapeutic class instance
    new_instance = models.OriginalTherapeuticClass.objects.get(
        pk=hc_dpd_original_therapeutic_class.pk
    )
    new_instance.pk = hc_dpd_original_therapeutic_class.pk + 9999
    new_instance.save()

    # Confirm checksum has changed due to new data
    old_checksum = checksum.checksum
    checksum.create_checksum()

    assert checksum.checksum != ''
    assert checksum.checksum != old_checksum
Beispiel #8
0
def test__dpd_checksum__create_checksum(calculate_checksum):
    """Tests that create_checksum updates expected fields."""
    # Create initial checksum model
    checksum = models.DPDChecksum(
        drug_code_start=0,
        drug_code_step=100000,
        extract_source=utils.ACTIVE_INGREDIENT
    )

    # Confirm no checksum details added yet
    assert checksum.checksum == ''
    assert checksum.checksum_date is None

    # Call method to generate checksum data
    calculate_checksum.return_value = 'TEST'
    checksum.create_checksum()

    # Confirm checksum data now added
    assert checksum.checksum == 'TEST'
    assert checksum.checksum_date is None