mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Moved MockRequest to tests/utils.py
This commit is contained in:
parent
dae6f0c4d8
commit
8310ad2336
2 changed files with 8 additions and 9 deletions
|
|
@ -1,18 +1,10 @@
|
||||||
from datasette.facets import ColumnFacet
|
from datasette.facets import ColumnFacet
|
||||||
from .fixtures import app_client # noqa
|
from .fixtures import app_client # noqa
|
||||||
|
from .utils import MockRequest
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
class MockRequest:
|
|
||||||
def __init__(self, url):
|
|
||||||
self.url = url
|
|
||||||
self.path = "/" + url.split("://")[1].split("/", 1)[1]
|
|
||||||
self.query_string = ""
|
|
||||||
if "?" in url:
|
|
||||||
self.query_string = url.split("?", 1)[1]
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_column_facet_suggest(app_client):
|
async def test_column_facet_suggest(app_client):
|
||||||
facet = ColumnFacet(
|
facet = ColumnFacet(
|
||||||
|
|
|
||||||
7
tests/utils.py
Normal file
7
tests/utils.py
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
class MockRequest:
|
||||||
|
def __init__(self, url):
|
||||||
|
self.url = url
|
||||||
|
self.path = "/" + url.split("://")[1].split("/", 1)[1]
|
||||||
|
self.query_string = ""
|
||||||
|
if "?" in url:
|
||||||
|
self.query_string = url.split("?", 1)[1]
|
||||||
Loading…
Add table
Add a link
Reference in a new issue