def testClearContents(self): user = PrincipalStub('srichter') annotationutil = zapi.getUtility(IPrincipalAnnotationUtility) annotations = annotationutil.getAnnotations(user) clipboard = IPrincipalClipboard(annotations) clipboard.clearContents() self.failUnless(clipboard.getContents() == ())
def testSetContents(self): user = PrincipalStub('srichter') annotationutil = zapi.getUtility(IPrincipalAnnotationUtility) annotations = annotationutil.getAnnotations(user) clipboard = IPrincipalClipboard(annotations) expected = ({'action':'move', 'target':'bla'}, {'action':'move', 'target':'bla/foo'}, {'action':'move', 'target':'bla/bar'}) clipboard.setContents(expected) self.failUnless(clipboard.getContents() == expected) clipboard.addItems('copy', ['bla']) expected = expected + ({'action':'copy', 'target':'bla'},) self.failUnless(clipboard.getContents() == expected)