Part of canonical.zeca.ftests.harness View In Hierarchy
Setup a zeca for use by functional tests
>>> ZecaTestSetup().setUp()
Make sure the server is running
>>> root_url = 'http://%s:%d' % ( ... config.gpghandler.host, config.gpghandler.port)
We have a hamless application root page
>>> from urllib import urlopen
>>> print urlopen(root_url).read() Copyright 2004-2009 Canonical Ltd. <BLANKLINE>
A key index lookup form via GET.
>>> print urlopen( ... '%s/pks/lookup?op=index&search=0xDFD20543' % root_url ... ).read() <html> ... <title>Results for Key 0xDFD20543</title> ... pub 1024D/DFD20543 2005-04-13 Sample Person (revoked) <sample.revoked@canonical.com> ...
A key content lookup form via GET.
>>> print urlopen( ... '%s/pks/lookup?op=get&' ... 'search=0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543' % root_url ... ).read() <html> ... <title>Results for Key 0xA419AE861E88BC9E04B9C26FBA2B9389DFD20543</title> ... -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.9 (GNU/Linux) <BLANKLINE> mQGiBEJdmOcRBADkNJPTBuCIefBdRAhvWyD9SSVHh8GHQWS7l9sRLEsirQkKz1yB ...
We can also request a key ID instead of a fingerprint, and it will glob for the fingerprint.
>>> print urlopen( ... '%s/pks/lookup?op=get&' ... 'search=0xDFD20543' % root_url ... ).read() <html> ... <title>Results for Key 0xDFD20543</title> ... -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.9 (GNU/Linux) <BLANKLINE> mQGiBEJdmOcRBADkNJPTBuCIefBdRAhvWyD9SSVHh8GHQWS7l9sRLEsirQkKz1yB ...
If we request a nonexistent key, we get a nice error.
>>> print urlopen( ... '%s/pks/lookup?op=get&' ... 'search=0xDFD20544' % root_url ... ).read() <html> ... <title>Results for Key 0xDFD20544</title> ... Key Not Found ...
A key submit form via POST (see doc/gpghandler.txt for more information).
>>> print urlopen('%s/pks/add' % root_url).read() <html> ... <title>Submit a key</title> ...
>>> ZecaTestSetup().tearDown()
And again for luck
>>> ZecaTestSetup().setUp()
>>> print urlopen(root_url).readline() Copyright 2004-2009 Canonical Ltd. <BLANKLINE>
>>> ZecaTestSetup().tearDown()
Method | setUpRoot | Recreate root directory and copy needed keys |
Method | root | Undocumented |
Method | tacfile | Undocumented |
Method | pidfile | Undocumented |
Method | logfile | Undocumented |
Inherited from TacTestSetup:
Method | setUp | Undocumented |
Method | tearDown | Undocumented |
Method | killTac | Kill the TAC file if it is running. |
Method | sendSignal | Send the given signal to the tac process. |
Method | _hasDaemonStarted | Has the daemon started? |
Method | _waitForDaemonStartup | Wait for the daemon to fully start. |