:tocdepth: 3 :py:mod:`gws.test.util` ======================= .. py:module:: gws.test.util .. autoapi-nested-parse:: Test utilities. **Source code:** :source:`gws.test.util` Module Contents --------------- .. py:data:: cast .. py:function:: ensure_dir(path, clear=False) .. py:function:: ewkb(wkt: str, srid=3857) .. py:data:: exec .. py:function:: feature(model, **atts) -> gws.Feature .. py:function:: feature_from_dict(model, atts) -> gws.Feature .. py:data:: fixture .. py:function:: fxml(s) .. py:function:: get_db(root) -> gws.DatabaseProvider .. py:function:: gws_root(config: str = '', specs: gws.SpecRuntime = None, activate=True, defaults=True) .. py:function:: gws_specs() -> gws.SpecRuntime .. py:function:: gws_system_user() .. py:class:: http .. py:method:: api(root, cmd, request=None, **kwargs) -> TestResponse :classmethod: .. py:method:: get(root, url, **kwargs) -> TestResponse :classmethod: .. py:function:: load_options(base_dir) .. py:class:: log .. py:method:: get() :classmethod: .. py:method:: reset() :classmethod: .. py:method:: write(s) :classmethod: .. py:data:: mock .. py:class:: mockserver .. py:method:: add(text) :classmethod: .. py:method:: post(verb, data='') :classmethod: .. py:method:: reset() :classmethod: .. py:method:: set(text) :classmethod: .. py:method:: url(path='') :classmethod: .. py:function:: model_context(**kwargs) .. py:data:: monkey_patch .. py:function:: option(name, default=None) .. py:data:: OPTIONS .. py:function:: path_in_base_dir(path) .. py:class:: pg .. py:attribute:: saEngine :type: Optional[gws.lib.sa.Engine] :value: None .. py:method:: clear(table_name: str) :classmethod: .. py:method:: connect() :classmethod: .. py:method:: connections() :classmethod: .. py:method:: content(sql_or_table_name: str) -> list[tuple] :classmethod: .. py:method:: create(table_name: str, col_defs: dict) :classmethod: .. py:method:: create_schema(name: str) :classmethod: .. py:method:: exec(sql: str, **kwargs) :classmethod: .. py:method:: insert(table_name: str, row_dicts: list[dict]) :classmethod: .. py:method:: rows(sql: str) -> list[tuple] :classmethod: .. py:method:: url() :classmethod: .. py:data:: raises .. py:function:: temp_dir_in_base_dir(keep=False) .. py:function:: temp_file_in_base_dir(content='', keep=False) .. py:class:: TestResponse(response: Iterable[bytes], status: str, headers: werkzeug.datastructures.Headers, request: werkzeug.wrappers.request.Request, history: tuple[TestResponse] = (), **kwargs: Any) Bases: :py:obj:`werkzeug.test.TestResponse` :class:`~werkzeug.wrappers.Response` subclass that provides extra information about requests made with the test :class:`Client`. 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 :meth:`close` to close any open files and prevent Python showing a ``ResourceWarning``. .. versionchanged:: 2.2 Set the ``default_mimetype`` to None to prevent a mimetype being assumed if missing. .. versionchanged:: 2.1 Response instances cannot be treated as tuples. .. versionadded:: 2.0 Test client methods always return instances of this class. .. py:attribute:: cookies :type: dict[str, werkzeug.test.Cookie] .. py:function:: unlink(path)