~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/testing/__init__.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-02-15 02:07:37 UTC
  • mfrom: (12344.2.16 daily-ajax)
  • Revision ID: launchpad@pqm.canonical.com-20110215020737-5mzlcotobwen1pej
[r=deryck, lifeless,
        wgrant][bug=673530][incr] Add a popup choice widget for the build
        frequency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
158
158
from lp.testing.fixture import ZopeEventHandlerFixture
159
159
from lp.testing.karma import KarmaRecorder
160
160
from lp.testing.matchers import Provides
161
 
from lp.testing.windmill import constants
 
161
from lp.testing.windmill import constants, lpuser
162
162
 
163
163
 
164
164
class FakeTime:
772
772
        # of things like https://launchpad.net/bugs/515494)
773
773
        self.client.open(url=self.layer.appserver_root_url())
774
774
 
 
775
    def getClientFor(self, obj, user=None, password='test', view_name=None):
 
776
        """Return a new client, and the url that it has loaded."""
 
777
        client = WindmillTestClient(self.suite_name)
 
778
        if user is not None:
 
779
            email = removeSecurityProxy(user).preferredemail.email
 
780
            client.open(url=lpuser.get_basic_login_url(email, password))
 
781
            client.waits.forPageLoad(timeout=constants.PAGE_LOAD)
 
782
        if isinstance(obj, basestring):
 
783
            url = obj
 
784
        else:
 
785
            url = canonical_url(
 
786
                obj, view_name=view_name, force_local_path=True)
 
787
        obj_url = self.layer.base_url + url
 
788
        client.open(url=obj_url)
 
789
        client.waits.forPageLoad(timeout=constants.PAGE_LOAD)
 
790
        return client, obj_url
 
791
 
775
792
 
776
793
class YUIUnitTestCase(WindmillTestCase):
777
794