Changeset 4489


Ignore:
Timestamp:
31 Jul 2009, 06:52:37 (15 years ago)
Author:
uli
Message:

Remove tests for which we need a functional setup (now covered in
detail in courserefs.txt).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/university/certificate.txt

    r4386 r4489  
    427427
    428428    >>> course = newdbroot['mydept'].courses['MYCOURSE']
    429     >>> certcourse = newdbroot['mydept'].certificates['MYCERT']['MYCOURSE']
     429    >>> certcourse = newdbroot['mydept'].certificates['MYCERT']['MYCOURSE_100']
    430430    >>> certcourse.course is course
    431431    True
     
    434434reflected in the certcourse.
    435435
    436 The interesting question now is: what happens to ``mycertcourse`` when
    437 the referenced course ``mycourse`` is deleted?
    438 
    439 Let's have a look:
    440 
    441     >>> list(newdbroot['mydept'].certificates['MYCERT'].keys())
    442     [u'MYCOURSE']
    443 
    444     >>> del newdbroot['mydept'].courses['MYCOURSE']
    445     >>> newdbroot['mydept']._p_changed = True
    446     >>> transaction.commit()
    447     >>> list(newdbroot['mydept'].certificates['MYCERT'].keys())
    448     []
    449 
    450 As we can see, the course was also removed from the certificate.
    451 
    452 We can of course also remove existing courses from certificates by
    453 using :meth:`delCourseRef`. This will not remove the same course from
    454 any course container:
    455 
    456     >>> mycourses = newdbroot['mydept'].courses
    457     >>> mycert = newdbroot['mydept'].certificates['MYCERT']
    458     >>> mycourses.addCourse(mycourse)
    459     >>> mycert.addCourseRef(mycourse)
    460     >>> c1 = mycourses['MYCOURSE']
    461     >>> c2 = mycert['MYCOURSE'].course
    462     >>> c1 is c2
    463     True
    464 
    465     >>> mycert.delCourseRef('MYCOURSE')
    466 
    467 The certificate now has no ``MYCOURSE`` course anymore, while the
    468 courses container still has:
    469 
    470     >>> 'MYCOURSE' in mycert.keys()
    471     False
    472 
    473     >>> mycourses['MYCOURSE']
    474     <waeup.university.course.Course object at 0x...>
    475 
    476 Clean up:
    477 
    478     >>> import os
    479     >>> os.unlink(dbpath)
Note: See TracChangeset for help on using the changeset viewer.