Deleting SchoolBell objects
===========================

This is, partially, a regression test.  When you delete a SchoolBell object,
all of its relationships should be broken -- otherwise other related object
will have references to an object that does not exist (due to ZODB garbage
collection semantics the object will exist, but it will have no __parent__
and will, therefore, break views that try to determine its absolute URL).

Set up
------

We create a SchoolBell instance

    >>> print http(r"""
    ... POST /@@contents.html HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... Content-Length: 81
    ... Content-Type: application/x-www-form-urlencoded
    ... Referer: http://localhost/@@contents.html?type_name=BrowserAdd__schoolbell.app.app.SchoolBellApplication
    ... 
    ... type_name=BrowserAdd__schoolbell.app.app.SchoolBellApplication&new_value=frogpond
    ... """)
    HTTP/1.1 303 See Other
    ...

We add a group

    >>> print http(r"""
    ... POST /frogpond/groups/+/addSchoolBellGroup.html%3D HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... Content-Length: 36
    ... Content-Type: application/x-www-form-urlencoded
    ...
    ... field.title=group1&UPDATE_SUBMIT=Add
    ... """)
    HTTP/1.1 303 See Other
    ...

We add a person

    >>> print http(r"""
    ... POST /frogpond/persons/add.html HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... Content-Length: 126
    ... Content-Type: application/x-www-form-urlencoded
    ...
    ... field.title=person1&field.username=person&field.password=&field.verify_password=&field.photo=&group.group1=on&UPDATE_SUBMIT=Add
    ... """)
    HTTP/1.1 303 See Other
    ...

We look at the groups of the person we added

    >>> print http(r"""
    ... GET /frogpond/persons/person HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... """)
    HTTP/1.1 200 Ok
    ...
    ...group1...
    ...

We look at the members of the group

    >>> print http(r"""
    ... GET /frogpond/groups/group1 HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... """)
    HTTP/1.1 200 Ok
    ...
    ...person1...

Test
----

We delete the person

    >>> print http(r"""
    ... POST /frogpond/persons/@@contents.html HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... Content-Type: application/x-www-form-urlencoded
    ... Content-Length: 46
    ...
    ... ids:list=person&container_delete_button=Delete
    ... """)
    HTTP/1.1 303 See Other
    ...

It is no longer there

    >>> print http(r"""
    ... GET /frogpond/persons/person HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... """)
    HTTP/1.1 404 Not Found
    ...

We look at the members of the group (this used to cause internal errors in an
earlier version of SchoolBell)

    >>> r = http(r"""
    ... GET /frogpond/groups/group1 HTTP/1.1
    ... Authorization: Basic mgr:mgrpw
    ... """)
    >>> print r
    HTTP/1.1 200 Ok
    ...

'person1' is no longer there

    >>> 'person1' not in str(r)
    True

