コード例 #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
ファイル: test_pricing.py プロジェクト: seasonstar/fnapy
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
ファイル: test_pricing.py プロジェクト: seasonstar/fnapy
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)