File: plugins.rst

package info (click to toggle)
atheist 0.20110402-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 1,332 kB
  • ctags: 902
  • sloc: python: 4,764; xml: 626; makefile: 113; cpp: 54; ansic: 5; sh: 5
file content (131 lines) | stat: -rw-r--r-- 2,686 bytes parent folder | download | duplicates (3)
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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
-----------------

Customizable Task methods:

.. function:: terminate()

   Ask task to finish as soon as possible and free its resources.
   Returns nothing.

.. function:: is_running()

   Returns a boolean about task is already running.


Customizable Conditions methods:

.. function:: __eq__()

   By default, conditions of same class are the same condition. You
   need to overwrite the __eq__() method to diferenciate instances of
   your Condidition subclass, depending on their attributes


.. Local Variables:
..  coding: utf-8
..  mode: flyspell
..  ispell-local-dictionary: "american"
.. End: