1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
Plugins
-------
It is possible to create plugin for Task and Conditions. This section
includes information about off-the-shelf plugins distributed with atheist.
Tasks
^^^^^
.. function:: DebPkgBuild
.. function:: DebPkgInstall
.. function:: DocTest
Wrapper to add standard `doctest
<http://docs.python.org/library/doctest.html>`_ to atheist testcases.
.. function:: TaskTerminator(task, [task,...], key-vals)
It's a special test to kill and **ensure** the termination of other
tasks.
The next example runs a netcat server for 10 seconds and then kills it::
nc = Daemon("nc -l -p 2000")
TaskTerminator(nc, delay=10)
.. _unittestcase:
.. function:: UnitTestCase
Wrapper for standard ``unitest.TestCase``. A sample::
class TestSample(unittest.TestCase):
def test_trivial():
self.assertEqual(1, 1)
UnitTestCase(TestSample)
.. function:: WebTest
It is a test to check webpages are correct and accessible.
**Authentication with cookie:**
If you want to get a page from a restricted site you may need a cookie
file::
WebTest('example.org', cookie='cookie.txt')
To get the cookie you may use a ``curl`` command similar to this::
curl -c cookie.txt -d "name=John.Doe&pass=secret&form_id=user_login" http://example.orrg/login
Conditions
^^^^^^^^^^
.. function:: CompositeCondition(oper, condition, [condition,...])
Apply an arbitrary operator to compose results for given
condition. It is the same idea of `compositetask`_ but applied to
conditions. Sample::
CompositeCondition(all, cond1, cond2)
.. function:: DebPkgInstalled(package)
Checks that Debian package *package* is installed.
.. function:: Or(condition, [condition,...])
Checks that at least one of the given conditions is satisfied.
.. function:: TaskFinished(task, [task,...])
Checks that all the given tasks are finished. Usually used with a
``Poll`` decorator.
.. function:: TaskRunning(task, [task,...])
Check that all the given tasks are running.
Extending atheist
-----------------
How to write a plugin... TODO
.. Local variables:
.. coding: utf-8
.. ispell-local-dictionary: "american"
.. End:
|