~ubuntu-branches/ubuntu/raring/grilo/raring-proposed

« back to all changes in this revision

Viewing changes to doc/grilo/plugins-testing.xml

  • Committer: Package Import Robot
  • Author(s): Alberto Garcia
  • Date: 2012-11-12 18:12:56 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20121112181256-2ee4rg7dbkh03a65
Tags: 0.2.3-1
* New upstream version.
* debian/rules: new API, bump package version in dh_makeshlibs.
* debian/rules: configure with --disable-debug, otherwise it's enabled
  by default.
* Drop all lintian-overrides files, there are no longer hardening
  warnings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
96
96
    Available metadata obtained for the selected item will be shown in the
97
97
    right pane for users to inspect.
98
98
  </para>
 
99
 
 
100
  <section>
 
101
    <title>Simulating Network Replies</title>
 
102
 
 
103
    <para>
 
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.
 
107
    </para>
 
108
 
 
109
    <para>
 
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.
 
114
    </para>
 
115
 
 
116
    <programlisting>
 
117
[default]
 
118
version = 1
 
119
ignored-parameters = field1[,field2[,...]] or "*"
 
120
 
 
121
[http://www.example.com]
 
122
data = content/of/response.txt
 
123
timeout = 500
 
124
    </programlisting>
 
125
 
 
126
    <para>
 
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.
 
131
    </para>
 
132
 
 
133
    <section>
 
134
      <title>The Default Section</title>
 
135
 
 
136
      <para>
 
137
        This section needs to be present in any mock reply configuration file.
 
138
 
 
139
        <itemizedlist>
 
140
          <listitem>
 
141
            <varname>version</varname> needs to be "1".
 
142
          </listitem>
 
143
 
 
144
          <listitem>
 
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&amp;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>.
 
154
          </listitem>
 
155
        </itemizedlist>
 
156
      </para>
 
157
    </section>
 
158
 
 
159
    <section>
 
160
      <title>The URL Sections</title>
 
161
 
 
162
      <para>
 
163
        The section title is used to map URLs to response files.
 
164
 
 
165
        <itemizedlist>
 
166
          <listitem>
 
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.
 
170
          </listitem>
 
171
 
 
172
          <listitem>
 
173
            <varname>timeout</varname> may be used to delay the response in
 
174
            seconds. The default is to not delay at all.
 
175
          </listitem>
 
176
        </itemizedlist>
 
177
 
 
178
        Skip the <varname>data</varname> field to provoke a "not found" error.
 
179
      </para>
 
180
    </section>
 
181
  </section>
99
182
</section>