Beispiel #1
0
def test_hours_for_price():
    manifest = {
        "id": "Test",
        "type": "pricing",
        "fields": {
            "hours_for_price": "pfh"
        }
    }
    cq = ContentQuestion(manifest)
    result = pricing_property(cq)
    assert "enum" in result['pfh'].keys()
Beispiel #2
0
def test_pricing_property_minmax_price():
    manifest = {
        "id": "Test",
        "type": "pricing",
        "fields": {
            "minimum_price": "priceMin",
            "maximum_price": "priceMax"
        }
    }
    cq = ContentQuestion(manifest)
    result = pricing_property(cq)
    assert not result['priceMin']['pattern'].startswith("^$|")
    assert not result['priceMax']['pattern'].startswith("^$|")
Beispiel #3
0
def test_pricing_property_price_unit_and_interval():
    manifest = {
        "id": "Test",
        "type": "pricing",
        "fields": {
            "price_unit": "priceUnit",
            "price_interval": "priceInterval"
        }
    }
    cq = ContentQuestion(manifest)
    result = pricing_property(cq)
    assert type(result['priceInterval']['enum']) == list
    assert type(result['priceUnit']['enum']) == list
Beispiel #4
0
def test_pricing_property_price_unit_and_interval_optional():
    manifest = {
        "id": "Test",
        "type": "pricing",
        "fields": {
            "price_unit": "priceUnit",
            "price_interval": "priceInterval"
        },
        "optional_fields": ["price_unit", "price_interval"]
    }
    cq = ContentQuestion(manifest)
    result = pricing_property(cq)
    assert "" in result['priceUnit']['enum']
    assert "" in result['priceInterval']['enum']
def test_pricing_property_price_unit_and_interval_optional():
    manifest = {
        "id": "Test",
        "type": "pricing",
        "fields": {
            "price_unit": "priceUnit",
            "price_interval": "priceInterval"
        },
        "optional_fields": [
            "price_unit",
            "price_interval"
        ]
    }
    cq = ContentQuestion(manifest)
    result = pricing_property(cq)
    assert "" in result['priceUnit']['enum']
    assert "" in result['priceInterval']['enum']