예제 #1
0
파일: test_pricing.py 프로젝트: kwgh/fnapy
def test_query_pricing_with_invalid_ean(monkeypatch, fake_manager):
    context = create_context_for_requests(monkeypatch, fake_manager,
                                          'query_pricing_with_invalid_ean',
                                          'pricing_query')
    with context:
        response = fake_manager.query_pricing(eans=['007'])
        errors = response.element.xpath('//ns:error',
                                        namespaces={'ns': XHTML_NAMESPACE})
        assert len(errors) != 0
예제 #2
0
def test_query_pricing(monkeypatch, fake_manager):
    context = create_context_for_requests(monkeypatch, fake_manager,
                                          'query_pricing', 'pricing_query')
    with context:
        fake_manager.query_pricing([
            {
                'value': '9780262510875',
                'type': 'Ean'
            },
            {
                'value': '2359109693',
                'type': 'Isbn'
            },
            {
                'value': '8172119',
                'type': 'FnacId'
            },
        ])
예제 #3
0
파일: test_pricing.py 프로젝트: kwgh/fnapy
def test_query_pricing_with_no_ean(monkeypatch, fake_manager):
    """query_pricing should display an error message and return the error
    response when more there no EANs are passed"""
    context = create_context_for_requests(monkeypatch, fake_manager,
                                          'query_pricing_with_no_ean',
                                          'pricing_query')
    with context:
        response = fake_manager.query_pricing(eans=[])
        errors = response.element.xpath('//ns:error',
                                        namespaces={'ns': XHTML_NAMESPACE})
        assert len(errors) == 1
예제 #4
0
def test_query_pricing_with_invalid_code_type(monkeypatch, fake_manager):
    context = create_context_for_requests(
        monkeypatch, fake_manager, 'query_pricing_with_invalid_code_type',
        'pricing_query')
    with context:
        response = fake_manager.query_pricing([
            {
                'value': '9780262510875',
                'type': 'X'
            },
            {
                'value': '2359109693',
                'type': 'Isbn'
            },
            {
                'value': '8172119',
                'type': 'FnacId'
            },
        ])
        errors = response.element.xpath('//ns:error',
                                        namespaces={'ns': XHTML_NAMESPACE})
        assert len(errors) != 0
예제 #5
0
파일: test_pricing.py 프로젝트: kwgh/fnapy
def test_query_pricing(monkeypatch, fake_manager):
    context = create_context_for_requests(monkeypatch, fake_manager,
                                          'query_pricing', 'pricing_query')
    with context:
        eans = [7321900286480, 9780262510875, 5060314991222]
        fake_manager.query_pricing(eans=eans)