gdata.test_config | index /usr/local/svn/gdata-python-client/src/gdata/test_config.py

`# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.`

Modules
`` |  |
atom gdata | getpass inspect | sys unittest |

Classes
`` |  | __builtin__.object ConfigCollection Option
class ConfigCollection(__builtin__.object)
`` |  | Methods defined here: __init__(self, options=None) get_value(self, option_name) register(self, *args, **kwargs) register_option(self, option) render_usage(self) set_value(self, option_name, value) Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class Option(__builtin__.object)
`` |  | Methods defined here: __init__(self, name, prompt, secret=False, description=None, default=None) get(self) Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`

Functions
`` |  | build_suite(classes) `Creates a TestSuite for all unit test classes in the list. Assumes that each of the classes in the list has unit test methods which begin with 'test'. Calls unittest.makeSuite. Returns: A new unittest.TestSuite containing a test suite for all classes.` check_clients_with_auth(test, classes) check_data_classes(test, classes) close_client(client) `Saves the recoded responses to a temp file if the config file allows. This should be called in the unit test's tearDown method. Checks to see if the 'savecache' option is set to 'true', to make sure we only save sessions to repeat if the user desires.` close_service(service) configure_cache(client, test_name) `Loads or begins a cached session to record HTTP traffic. Should be called at the beginning of each test method. Args: client: a gdata.GDClient whose http_client member has been replaced with a atom.mock_http_core.MockHttpClient so that repeated executions can used cached responses instead of contacting the server. test_name: str The name of this test method. Examples: 'TestClass.test_x_works', 'TestClass.test_crud_operations'. This is used to name the recording of the HTTP requests and responses, so it should be unique to each test method in the test case.` configure_client(client, case_name, service_name, use_apps_auth=False) `Sets up a mock client which will reuse a saved session. Should be called during setUp of each unit test. Handles authentication to allow the GDClient to make requests which require an auth header. Args: client: a gdata.GDClient whose http_client member should be replaced with a atom.mock_http_core.MockHttpClient so that repeated executions can used cached responses instead of contacting the server. case_name: str The name of the test case class. Examples: 'BloggerTest', 'ContactsTest'. Used to save a session for the ClientLogin auth token request, so the case_name should be reused if and only if the same username, password, and service are being used. service_name: str The service name as used for ClientLogin to identify the Google Data API being accessed. Example: 'blogger', 'wise', etc. use_apps_auth: bool (optional) If set to True, use appsusername and appspassword command-line args instead of username and password respectively.` configure_service(service, case_name, service_name) `Sets up a mock GDataService v1 client to reuse recorded sessions. Should be called during setUp of each unit test. This is a duplicate of configure_client, modified to handle old v1 service classes.` configure_service_cache(service, test_name) `Loads or starts a session recording for a v1 Service object. Duplicates the behavior of configure_cache, but the target for this function is a v1 Service object instead of a v2 Client.`

Data
`` |  | APPS_DOMAIN_OPTION = <gdata.test_config.Option object at 0xbc8810> BLOG_ID_OPTION = <gdata.test_config.Option object at 0xbc8750> GA_TABLE_ID = <gdata.test_config.Option object at 0xbc8910> ISSUE_ASSIGNEE_OPTION = <gdata.test_config.Option object at 0xbc88d0> PROJECT_NAME_OPTION = <gdata.test_config.Option object at 0xbc8890> SITES_NAME_OPTION = <gdata.test_config.Option object at 0xbc8850> SPREADSHEET_ID_OPTION = <gdata.test_config.Option object at 0xbc87d0> TEST_IMAGE_LOCATION_OPTION = <gdata.test_config.Option object at 0xbc8790> options = <gdata.test_config.ConfigCollection object at 0xbc84d0>