Example #1
0
 def test_default(self):
     client = _get_bakery_client()
     [interaction_method] = client._interaction_methods
     self.assertIsInstance(interaction_method, WebBrowserInteractor)
     # Use the in-browser interaction
     self.assertIs(interaction_method._open_web_browser,
                   visit_page_with_browser)
Example #2
0
 def test_with_credentials_invalid_format(self):
     self.patch(os, 'environ', {'MAAS_CANDID_CREDENTIALS': 'foobar'})
     client = _get_bakery_client()
     [interaction_method] = client._interaction_methods
     self.assertIsInstance(interaction_method, WebBrowserInteractor)
     # Use the in-browser interaction
     self.assertIs(interaction_method._open_web_browser,
                   visit_page_with_browser)
Example #3
0
 def test_with_credentials_from_env(self):
     self.patch(os, 'environ', {'MAAS_CANDID_CREDENTIALS': 'user:pass'})
     client = _get_bakery_client()
     [interaction_method] = client._interaction_methods
     self.assertIsInstance(interaction_method, WebBrowserInteractor)
     # use a custom method to interact with the form
     self.assertIsNot(interaction_method._open_web_browser,
                      visit_page_with_browser)
Example #4
0
 def test_with_auth_info(self):
     agent = Agent(url="http://auth.example.com", username="******")
     auth_info = AuthInfo(key="a key", agents=[agent])
     client = _get_bakery_client(auth_info=auth_info)
     [interaction_method] = client._interaction_methods
     self.assertIsInstance(interaction_method, AgentInteractor)