unittests, ui_factory & Http Auth
Viktor Nagy
viktor.nagy at gmail.com
Mon Feb 2 23:04:03 GMT 2009
Hi,
I am trying to integrate bzr with a service I'm developing, and would like
to write a python library to simplify "desktop" integration. The service
uses bzr+http with http auth, and can't find out how to write a unittest
that would "ask" for some test credentials. If needed the credentials can be
hard-coded to the unittest.
in the library I have a code to do a checkout
def checkout_or_update(self):
...
accelerator, source = \
bzrlib.bzrdir.BzrDir.open_tree_or_branch(self._get_remote_path())
source.create_checkout(self.location, None, False, accelerator)
...
and wrote a unittest, that first changes bzrlib.ui.ui_factory to
CLIUIFactory and then calls the above method
rsp = project.checkout_or_update()
The unittest fails as
NotATerminal: Unable to ask for a password without real terminal.
My idea would be to create a custom CLIUIFactory that overwrites the
get_password method with the test password, but this seems to me like dirty
hacking as I might introduce a bug in my own code if my implementation is
wrong.
So how to pass on user credentials to bzr at unittest?
Note that I prefer to run the tests from eclipse, that is in an unbuffered
python shell.
Thanks for your help!
Viktor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/bazaar/attachments/20090203/2cb8e53b/attachment-0001.htm
More information about the bazaar
mailing list