gws.test.util
¶
Test utilities.
Source code: gws.test.util
Module Contents¶
- gws.test.util.cast¶
- gws.test.util.ensure_dir(path, clear=False)¶
- gws.test.util.ewkb(wkt: str, srid=3857)¶
- gws.test.util.exec¶
- gws.test.util.feature(model, **atts) gws.Feature ¶
- gws.test.util.fixture¶
- gws.test.util.fxml(s)¶
- gws.test.util.get_db(root)¶
- gws.test.util.gws_root(config: str = '', specs: gws.SpecRuntime = None, activate=True, defaults=True)¶
- gws.test.util.gws_specs() gws.SpecRuntime ¶
- gws.test.util.gws_system_user()¶
- class gws.test.util.http¶
- classmethod api(root, cmd, request=None, **kwargs) TestResponse ¶
- classmethod get(root, url, **kwargs) TestResponse ¶
- gws.test.util.mock¶
- class gws.test.util.mockserver¶
- classmethod add(text)¶
- classmethod post(verb, data='')¶
- classmethod reset()¶
- classmethod set(text)¶
- classmethod url(path='')¶
- gws.test.util.model_context(**kwargs)¶
- gws.test.util.monkey_patch¶
- gws.test.util.option(name, default=None)¶
- gws.test.util.OPTIONS¶
- gws.test.util.path_in_base_dir(path)¶
- class gws.test.util.pg¶
- saConn: gws.lib.sa.Connection | None¶
- saEngine: gws.lib.sa.Engine | None¶
- classmethod clear(table_name: str)¶
- classmethod close()¶
- classmethod connect()¶
- classmethod content(sql_or_table_name: str) list[tuple] ¶
- classmethod create(table_name: str, col_defs: dict)¶
- classmethod exec(sql: str, **kwargs)¶
- classmethod insert(table_name: str, row_dicts: list[dict])¶
- classmethod rows(sql: str) list[tuple] ¶
- gws.test.util.raises¶
- gws.test.util.temp_dir_in_base_dir(keep=False)¶
- gws.test.util.temp_file_in_base_dir(content='', keep=False)¶
- class gws.test.util.TestResponse(response: Iterable[bytes], status: str, headers: werkzeug.datastructures.Headers, request: werkzeug.wrappers.request.Request, history: tuple[TestResponse] = (), **kwargs: Any)¶
Bases:
werkzeug.test.TestResponse
Response
subclass that provides extra information about requests made with the testClient
.Test client requests will always return an instance of this class. If a custom response class is passed to the client, it is subclassed along with this to support test information.
If the test request included large files, or if the application is serving a file, call
close()
to close any open files and prevent Python showing aResourceWarning
.Changed in version 2.2: Set the
default_mimetype
to None to prevent a mimetype being assumed if missing.Changed in version 2.1: Response instances cannot be treated as tuples.
New in version 2.0: Test client methods always return instances of this class.
- cookies: dict[str, werkzeug.test.Cookie]¶
- gws.test.util.unlink(path)¶