source: waeup/branches/ulif-rewrite/src/waeup/university/certificate.txt @ 4312

Last change on this file since 4312 was 4312, checked in by uli, 16 years ago

Update certificate tests.

File size: 2.0 KB
Line 
1Certificates
2************
3
4:Test-Layer: unit
5
6Creating certificates
7=====================
8
9Because certificates make use of components registered with the Zope
10Component Architecture (ZCA), we first have to grok the `waeup`
11package. This happens automatically in real-world use:
12
13    >>> import grok
14    >>> grok.testing.grok('waeup')
15
16We can create certificates:
17
18    >>> from waeup.university.certificate import Certificate
19    >>> mycertificate = Certificate()
20    >>> mycertificate
21    <waeup.university.certificate.Certificate object at 0x...>
22
23Another way to create certificates is by asking for a factory called
24``waeup.Certificate``. This way we can create a factory without
25importing a class:
26
27    >>> from zope.component import createObject
28    >>> mycertificate = createObject(u'waeup.Certificate')
29    >>> mycertificate
30    <waeup.university.certificate.Certificate object at 0x...>
31
32
33Certificate attributes
34======================
35
36Certificates have the attributes required by the `ICertificate` interface:
37
38    >>> from waeup.interfaces import ICertificate
39    >>> ICertificate.providedBy(mycertificate)
40    True
41
42    >>> from zope.interface.verify import verifyObject
43    >>> verifyObject(ICertificate, mycertificate)
44    True
45
46Each of the following attributes is mandatory.
47
48`title`
49-------
50
51Each certificate has a title:
52
53    >>> mycertificate.title
54    u'Unnamed Certificate'
55
56`code`
57------
58
59Each certificate holds a code, which might be a shortcut or abbreviation
60of the real certificate name. By default the code is ``NA`` (=not assigned):
61
62    >>> mycertificate.code
63    u'NA'
64
65`review_state`
66--------------
67
68The review state can have one of the ``checking`` states defined in
69the WAeUP workflow. These are at least the states ``checked`` and
70``unchecked``. After a certificate is created, the review state is
71``unchecked``:
72
73    >>> mycertificate.review_state
74    'unchecked'
75
76We can mark a certificate as checked:
77
78    >>> mycertificate.check()
79    >>> mycertificate.review_state
80    'checked'
81
82We cannot uncheck a certificate:
83
84    >>> mycertificate.review_state = 'init'
Note: See TracBrowser for help on using the repository browser.