96
96
Available metadata obtained for the selected item will be shown in the
97
97
right pane for users to inspect.
101
<title>Simulating Network Replies</title>
104
For for offline testing of plug-ins, especially in automated tests it is
105
useful to simulate and reply predefined network replies. Therefore Grilo
106
provides a few facilities for mocking network replies.
110
To enable mocking set the environment variable GRL_NET_MOCKED. The value
111
of this variable is interpreted as path of the mock configuration file to
112
use. This file is a simple .ini file is used which is The file is split
113
into a "default" section and one section per URL to mock.
119
ignored-parameters = field1[,field2[,...]] or "*"
121
[http://www.example.com]
122
data = content/of/response.txt
127
An easy way to capture the responses is to run your application with the
128
environment variable GRL_NET_CAPTURE_DIR. GrlNetWc will then write all
129
each response into a file following the pattern "url-timestamp". If the
130
directory does not exist yet it will be created.
134
<title>The Default Section</title>
137
This section needs to be present in any mock reply configuration file.
141
<varname>version</varname> needs to be "1".
145
<varname>ignored-parameters</varname> is a comma separated list of
146
query parameter names that can be used to map URLs to sections
147
without paying attention to query parameters listed here.
148
By setting a value of "api_key" a request for
149
<code>http://www.example.com?q=test+query&api_key=dummy</code>
150
will be answered with the mock data for
151
<code>http://www.example.com?q=test+query</code>.
152
Setting "api_key,q" or "*" will result in mock answer for
153
<code>http://www.example.com</code>.
160
<title>The URL Sections</title>
163
The section title is used to map URLs to response files.
167
<varname>data</varname> is a path to a text file containing the
168
raw response of the websserver. The path may be relative to this
169
configuration file or an absolute path.
173
<varname>timeout</varname> may be used to delay the response in
174
seconds. The default is to not delay at all.
178
Skip the <varname>data</varname> field to provoke a "not found" error.