| |
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
| <html><head><title>Python: module gdata.test_config</title> |
| </head><body bgcolor="#f0f0f8"> |
| |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> |
| <tr bgcolor="#7799ee"> |
| <td valign=bottom> <br> |
| <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="gdata.html"><font color="#ffffff">gdata</font></a>.test_config</strong></big></big></font></td |
| ><td align=right valign=bottom |
| ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/usr/local/google/home/afshar/src/external-gdata-release/google3/src/gdata/test_config.py">/usr/local/google/home/afshar/src/external-gdata-release/google3/src/gdata/test_config.py</a></font></td></tr></table> |
| <p><tt># Copyright (C) 2009 Google Inc.<br> |
| #<br> |
| # Licensed under the Apache License, Version 2.0 (the "License");<br> |
| # you may not use this file except in compliance with the License.<br> |
| # You may obtain a copy of the License at<br> |
| #<br> |
| # <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a><br> |
| #<br> |
| # Unless required by applicable law or agreed to in writing, software<br> |
| # distributed under the License is distributed on an "AS IS" BASIS,<br> |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br> |
| # See the License for the specific language governing permissions and<br> |
| # limitations under the License.</tt></p> |
| <p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#aa55cc"> |
| <td colspan=3 valign=bottom> <br> |
| <font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr> |
| |
| <tr><td bgcolor="#aa55cc"><tt> </tt></td><td> </td> |
| <td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="atom.html">atom</a><br> |
| <a href="gdata.html">gdata</a><br> |
| </td><td width="25%" valign=top><a href="getpass.html">getpass</a><br> |
| <a href="inspect.html">inspect</a><br> |
| </td><td width="25%" valign=top><a href="sys.html">sys</a><br> |
| <a href="unittest.html">unittest</a><br> |
| </td><td width="25%" valign=top></td></tr></table></td></tr></table><p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#ee77aa"> |
| <td colspan=3 valign=bottom> <br> |
| <font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr> |
| |
| <tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td> |
| <td width="100%"><dl> |
| <dt><font face="helvetica, arial"><a href="__builtin__.html#object">__builtin__.object</a> |
| </font></dt><dd> |
| <dl> |
| <dt><font face="helvetica, arial"><a href="gdata.test_config.html#ConfigCollection">ConfigCollection</a> |
| </font></dt><dt><font face="helvetica, arial"><a href="gdata.test_config.html#Option">Option</a> |
| </font></dt></dl> |
| </dd> |
| </dl> |
| <p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#ffc8d8"> |
| <td colspan=3 valign=bottom> <br> |
| <font color="#000000" face="helvetica, arial"><a name="ConfigCollection">class <strong>ConfigCollection</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> |
| |
| <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> |
| <td width="100%">Methods defined here:<br> |
| <dl><dt><a name="ConfigCollection-__init__"><strong>__init__</strong></a>(self, options<font color="#909090">=None</font>)</dt></dl> |
| |
| <dl><dt><a name="ConfigCollection-get_value"><strong>get_value</strong></a>(self, option_name)</dt></dl> |
| |
| <dl><dt><a name="ConfigCollection-register"><strong>register</strong></a>(self, *args, **kwargs)</dt></dl> |
| |
| <dl><dt><a name="ConfigCollection-register_option"><strong>register_option</strong></a>(self, option)</dt></dl> |
| |
| <dl><dt><a name="ConfigCollection-render_usage"><strong>render_usage</strong></a>(self)</dt></dl> |
| |
| <dl><dt><a name="ConfigCollection-set_value"><strong>set_value</strong></a>(self, option_name, value)</dt></dl> |
| |
| <hr> |
| Data descriptors defined here:<br> |
| <dl><dt><strong>__dict__</strong></dt> |
| <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| </dl> |
| <dl><dt><strong>__weakref__</strong></dt> |
| <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| </dl> |
| </td></tr></table> <p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#ffc8d8"> |
| <td colspan=3 valign=bottom> <br> |
| <font color="#000000" face="helvetica, arial"><a name="Option">class <strong>Option</strong></a>(<a href="__builtin__.html#object">__builtin__.object</a>)</font></td></tr> |
| |
| <tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td> |
| <td width="100%">Methods defined here:<br> |
| <dl><dt><a name="Option-__init__"><strong>__init__</strong></a>(self, name, prompt, secret<font color="#909090">=False</font>, description<font color="#909090">=None</font>, default<font color="#909090">=None</font>)</dt></dl> |
| |
| <dl><dt><a name="Option-get"><strong>get</strong></a>(self)</dt></dl> |
| |
| <hr> |
| Data descriptors defined here:<br> |
| <dl><dt><strong>__dict__</strong></dt> |
| <dd><tt>dictionary for instance variables (if defined)</tt></dd> |
| </dl> |
| <dl><dt><strong>__weakref__</strong></dt> |
| <dd><tt>list of weak references to the object (if defined)</tt></dd> |
| </dl> |
| </td></tr></table></td></tr></table><p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#eeaa77"> |
| <td colspan=3 valign=bottom> <br> |
| <font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr> |
| |
| <tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td> |
| <td width="100%"><dl><dt><a name="-build_suite"><strong>build_suite</strong></a>(classes)</dt><dd><tt>Creates a TestSuite for all unit test classes in the list.<br> |
| <br> |
| Assumes that each of the classes in the list has unit test methods which<br> |
| begin with 'test'. Calls unittest.makeSuite.<br> |
| <br> |
| Returns: <br> |
| A new unittest.TestSuite containing a test suite for all classes.</tt></dd></dl> |
| <dl><dt><a name="-check_clients_with_auth"><strong>check_clients_with_auth</strong></a>(test, classes)</dt></dl> |
| <dl><dt><a name="-check_data_classes"><strong>check_data_classes</strong></a>(test, classes)</dt></dl> |
| <dl><dt><a name="-close_client"><strong>close_client</strong></a>(client)</dt><dd><tt>Saves the recoded responses to a temp file if the config file allows.<br> |
| <br> |
| This should be called in the unit test's tearDown method.<br> |
| <br> |
| Checks to see if the 'savecache' option is set to 'true', to make sure we<br> |
| only save sessions to repeat if the user desires.</tt></dd></dl> |
| <dl><dt><a name="-close_service"><strong>close_service</strong></a>(service)</dt></dl> |
| <dl><dt><a name="-configure_cache"><strong>configure_cache</strong></a>(client, test_name)</dt><dd><tt>Loads or begins a cached session to record HTTP traffic.<br> |
| <br> |
| Should be called at the beginning of each test method.<br> |
| <br> |
| Args:<br> |
| client: a gdata.GDClient whose http_client member has been replaced<br> |
| with a atom.mock_http_core.MockHttpClient so that repeated<br> |
| executions can used cached responses instead of contacting<br> |
| the server.<br> |
| test_name: str The name of this test method. Examples: <br> |
| 'TestClass.test_x_works', 'TestClass.test_crud_operations'.<br> |
| This is used to name the recording of the HTTP requests and<br> |
| responses, so it should be unique to each test method in the<br> |
| test case.</tt></dd></dl> |
| <dl><dt><a name="-configure_client"><strong>configure_client</strong></a>(client, case_name, service_name, use_apps_auth<font color="#909090">=False</font>)</dt><dd><tt>Sets up a mock client which will reuse a saved session.<br> |
| <br> |
| Should be called during setUp of each unit test.<br> |
| <br> |
| Handles authentication to allow the GDClient to make requests which<br> |
| require an auth header.<br> |
| <br> |
| Args:<br> |
| client: a gdata.GDClient whose http_client member should be replaced<br> |
| with a atom.mock_http_core.MockHttpClient so that repeated<br> |
| executions can used cached responses instead of contacting<br> |
| the server.<br> |
| case_name: str The name of the test case class. Examples: 'BloggerTest',<br> |
| 'ContactsTest'. Used to save a session<br> |
| for the ClientLogin auth token request, so the case_name<br> |
| should be reused if and only if the same username, password,<br> |
| and service are being used.<br> |
| service_name: str The service name as used for ClientLogin to identify<br> |
| the Google Data API being accessed. Example: 'blogger',<br> |
| 'wise', etc.<br> |
| use_apps_auth: bool (optional) If set to True, use appsusername and<br> |
| appspassword command-line args instead of username and<br> |
| password respectively.</tt></dd></dl> |
| <dl><dt><a name="-configure_service"><strong>configure_service</strong></a>(service, case_name, service_name)</dt><dd><tt>Sets up a mock GDataService v1 client to reuse recorded sessions.<br> |
| <br> |
| Should be called during setUp of each unit test. This is a duplicate of<br> |
| configure_client, modified to handle old v1 service classes.</tt></dd></dl> |
| <dl><dt><a name="-configure_service_cache"><strong>configure_service_cache</strong></a>(service, test_name)</dt><dd><tt>Loads or starts a session recording for a v1 Service <a href="__builtin__.html#object">object</a>.<br> |
| <br> |
| Duplicates the behavior of configure_cache, but the target for this<br> |
| function is a v1 Service <a href="__builtin__.html#object">object</a> instead of a v2 Client.</tt></dd></dl> |
| </td></tr></table><p> |
| <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section"> |
| <tr bgcolor="#55aa55"> |
| <td colspan=3 valign=bottom> <br> |
| <font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr> |
| |
| <tr><td bgcolor="#55aa55"><tt> </tt></td><td> </td> |
| <td width="100%"><strong>APPS_DOMAIN_OPTION</strong> = <gdata.test_config.Option object><br> |
| <strong>BLOG_ID_OPTION</strong> = <gdata.test_config.Option object><br> |
| <strong>GA_TABLE_ID</strong> = <gdata.test_config.Option object><br> |
| <strong>ISSUE_ASSIGNEE_OPTION</strong> = <gdata.test_config.Option object><br> |
| <strong>PROJECT_NAME_OPTION</strong> = <gdata.test_config.Option object><br> |
| <strong>SITES_NAME_OPTION</strong> = <gdata.test_config.Option object><br> |
| <strong>SPREADSHEET_ID_OPTION</strong> = <gdata.test_config.Option object><br> |
| <strong>TARGET_USERNAME_OPTION</strong> = <gdata.test_config.Option object><br> |
| <strong>TEST_IMAGE_LOCATION_OPTION</strong> = <gdata.test_config.Option object><br> |
| <strong>YT_CLIENT_ID_OPTION</strong> = <gdata.test_config.Option object><br> |
| <strong>YT_DEVELOPER_KEY_OPTION</strong> = <gdata.test_config.Option object><br> |
| <strong>YT_VIDEO_ID_OPTION</strong> = <gdata.test_config.Option object><br> |
| <strong>options</strong> = <gdata.test_config.ConfigCollection object></td></tr></table> |
| </body></html> |