Certificates
************

:Test-Layer: unit

Creating certificates
=====================

We can create certificates:

    >>> from waeup.university.certificate import Certificate
    >>> mycertificate = Certificate()
    >>> mycertificate
    <waeup.university.certificate.Certificate object at 0x...>

Another way to create certificates is by asking for a factory called
``waeup.Certificate``. Before we can do this, we have to grok the `waeup`
package. This happens automatically in real-world use:

    >>> import grok
    >>> grok.testing.grok('waeup')

Now we can create a factory without importing a class:

    >>> from zope.component import createObject
    >>> mycertificate = createObject(u'waeup.Certificate')
    >>> mycertificate
    <waeup.university.certificate.Certificate object at 0x...>

Certificate attributes
==================

Certificates have the attributes required by the `ICertificate` interface:

    >>> from waeup.interfaces import ICertificate
    >>> ICertificate.providedBy(mycertificate)
    True

    >>> from zope.interface.verify import verifyObject
    >>> verifyObject(ICertificate, mycertificate)
    True

Each of the following attributes is mandatory.

`title`
-------

Each certificate has a title:

    >>> mycertificate.title
    u'Unnamed Certificate'

`code`
------

Each certificate holds a code, which might be a shortcut or abbreviation
of the real certificate name. By default the code is ``NA`` (=not assigned):

    >>> mycertificate.code
    u'NA'
