Departments
***********

:Test-Layer: unit

Creating departments
====================

We can create departments:

    >>> from waeup.university.department import Department
    >>> mydept = Department()
    >>> mydept
    <waeup.university.department.Department object at 0x...>

Another way to create departments is by asking for a factory called
``waeup.Department``. 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 department without importing a class:

    >>> from zope.component import createObject
    >>> mydept = createObject(u'waeup.Department')
    >>> mydept
    <waeup.university.department.Department object at 0x...>

Department attributes
=====================

Departments have the attributes required by the `IDepartment` interface:

    >>> from waeup.interfaces import IDepartment
    >>> IDepartment.providedBy(mydept)
    True

    >>> from zope.interface.verify import verifyObject
    >>> verifyObject(IDepartment, mydept)
    True

Each of the following attributes is mandatory.

`title`
-------

Each department has a title:

    >>> mydept.title
    u'Unnamed Department'

`title_prefix`
--------------

Each department has a title prefix, which specifies the kind of
institution:

    >>> mydept.title_prefix
    u'department'

`code`
------

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

    >>> mydept.code
    u'NA'
