Example #1
0
def test_search(rf, admin_user):
    request = apply_request_middleware(rf.get("/"), user=admin_user)
    with replace_modules([ATestModule]):
        assert any(sr.to_json()["text"] == "yes"
                   for sr in get_search_results(request, "yes"))
        assert any(
            sr.url == "/OK"
            for sr in get_search_results(request, "spooky"))  # Test aliases
        assert any(sr.target == "_blank"
                   for sr in get_search_results(request, "yes"))
Example #2
0
def test_search(rf):
    request = rf.get("/")
    with replace_modules([ATestModule]):
        assert any(sr.to_json()["text"] == "yes"
                   for sr in get_search_results(request, "yes"))
        assert any(
            sr.url == "/OK"
            for sr in get_search_results(request, "spooky"))  # Test aliases
        assert any(sr.target == "_blank"
                   for sr in get_search_results(request, "yes"))
Example #3
0
def test_product_module_search(rf, admin_user):
    get_default_shop()
    request = apply_request_middleware(rf.get("/"), user=admin_user)

    with replace_modules([ProductModule]):
        with admin_only_urls():
            default_product = get_default_product()
            model_url = get_model_url(default_product)
            sku = default_product.sku
            assert any(sr.url == model_url for sr in get_search_results(request, query=sku))  # Queries work
            assert any(sr.is_action for sr in get_search_results(request, query=sku[:5]))  # Actions work
            assert empty_iterable(get_search_results(request, query=sku[:2]))  # Short queries don't
Example #4
0
def test_product_module_search(rf, admin_user):
    get_default_shop()
    request = apply_request_middleware(rf.get("/"), user=admin_user)

    with replace_modules([ProductModule]):
        with admin_only_urls():
            default_product = get_default_product()
            model_url = get_model_url(default_product)
            sku = default_product.sku
            assert any(sr.url == model_url for sr in get_search_results(request, query=sku))  # Queries work
            assert any(sr.is_action for sr in get_search_results(request, query=sku[:5]))  # Actions work
            assert empty_iterable(get_search_results(request, query=sku[:2]))  # Short queries don't
Example #5
0
def test_product_module_search(rf, admin_user):
    get_default_shop()
    request = apply_request_middleware(rf.get("/"), user=admin_user)

    with replace_modules([CategoryModule, ImportAdminModule, ProductModule, MediaModule,
                          ProductTypeModule, ManufacturerModule, PaymentMethodModule, ShippingMethodModule]):
        with admin_only_urls():
            default_product = get_default_product()
            model_url = get_model_url(default_product, shop=get_shop(request))
            sku = default_product.sku
            assert any(sr.url == model_url for sr in get_search_results(request, query=sku))  # Queries work
            assert any(sr.is_action for sr in get_search_results(request, query=sku[:5]))  # Actions work
            assert empty_iterable(get_search_results(request, query=sku[:2]))  # Short queries don't
def test_product_module_search(rf, admin_user):
    get_default_shop()
    request = apply_request_middleware(rf.get("/"), user=admin_user)

    with replace_modules([CategoryModule, ImportAdminModule, ProductModule,
                          ProductTypeModule, ManufacturerModule, PaymentMethodModule, ShippingMethodModule]):
        with admin_only_urls():
            default_product = get_default_product()
            model_url = get_model_url(default_product, shop=get_shop(request))
            sku = default_product.sku
            assert any(sr.url == model_url for sr in get_search_results(request, query=sku))  # Queries work
            assert any(sr.is_action for sr in get_search_results(request, query=sku[:5]))  # Actions work
            assert empty_iterable(get_search_results(request, query=sku[:2]))  # Short queries don't
Example #7
0
def test_search(client, rf):
    if "shuup.guide" not in settings.INSTALLED_APPS:
        pytest.skip("Need shuup.guide in INSTALLED_APPS")
    request = rf.get("/")
    search_term = "customer"
    request.session = client.session
    with replace_modules([GuideAdminModule]):
        with override_settings(SHUUP_GUIDE_FETCH_RESULTS=False):
            results = get_search_results(request, search_term)
            assert [r for r in results if search_term in r.text]
Example #8
0
def test_search(client, rf):
    if "shuup.guide" not in settings.INSTALLED_APPS:
        pytest.skip("Need shuup.guide in INSTALLED_APPS")
    request = rf.get("/")
    search_term = "customer"
    request.session = client.session
    with replace_modules([GuideAdminModule]):
        with override_settings(SHUUP_GUIDE_FETCH_RESULTS=False):
            results = get_search_results(request, search_term)
            assert [r for r in results if search_term in r.text]
Example #9
0
def test_search(rf):
    request = rf.get("/")
    with replace_modules([ATestModule]):
        assert any(sr.to_json()["text"] == "yes" for sr in get_search_results(request, "yes"))
        assert any(sr.url == "/OK" for sr in get_search_results(request, "spooky"))  # Test aliases
        assert any(sr.target == "_blank" for sr in get_search_results(request, "yes"))
Example #10
0
def test_search(rf, admin_user):
    request = apply_request_middleware(rf.get("/"), user=admin_user)
    with replace_modules([ATestModule]):
        assert any(sr.to_json()["text"] == "yes" for sr in get_search_results(request, "yes"))
        assert any(sr.url == "/OK" for sr in get_search_results(request, "spooky"))  # Test aliases
        assert any(sr.target == "_blank" for sr in get_search_results(request, "yes"))