[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Folder/Views/Browser/tests - __init__.py:1.1.4.1 testFolderAdder.py:1.1.4.1 testFolderContents.py:1.1.4.1 testLoadedFolderContents.py:1.1.4.1

Stephan Richter srichter@cbu.edu
Wed, 27 Mar 2002 10:54:45 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Folder/Views/Browser/tests
In directory cvs.zope.org:/tmp/cvs-serv12282/Folder/Views/Browser/tests

Added Files:
      Tag: Zope-3x-branch
	__init__.py testFolderAdder.py testFolderContents.py 
	testLoadedFolderContents.py 
Log Message:
New Content Objects:

- NaiveFile --> all the data is stored in one string
- File --> Uses a BTree to store the data in chunks (more efficient)
- Image --> Can store and display an image a la Z2 (based on File)
- ZPTPage --> A simple version of ZPT for the content space to allow some 
  dynamics data (please do not use this for scripting)

Also:

- Expansion of supported views
- all edit screens are Formulator supported



=== Added File Zope3/lib/python/Zope/App/OFS/Folder/Views/Browser/tests/__init__.py ===


=== Added File Zope3/lib/python/Zope/App/OFS/Folder/Views/Browser/tests/testFolderAdder.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# 
##############################################################################
"""

Revision information:
$Id: testFolderAdder.py,v 1.1.4.1 2002/03/27 15:54:44 srichter Exp $
"""

from unittest import TestCase, TestSuite, main, makeSuite
from Zope.App.OFS.Container.Views.Browser.tests.AdderBaseTests \
     import BaseRegistryTest, BaseAddingTest
from Zope.App.ZMI.Addable import ContentAddables

class Methods:
    # Supply the methds needed by the bases.

    def _TestView__newContext(self):
        from Zope.App.OFS.Folder.Folder import Folder
        return Folder()

    def _TestView__newView(self, container):
        from Zope.App.OFS.Folder.FolderAdder import FolderAdder 
        return FolderAdder(container)

    def _TestAdderView__registry(self):
        return ContentAddables
    

class RegistryTest(Methods, BaseRegistryTest, TestCase): pass
class AddingTest(Methods, BaseAddingTest, TestCase): pass

def test_suite():
    return TestSuite([makeSuite(RegistryTest),
                      makeSuite(AddingTest),
                      ])

if __name__=='__main__':
    main(defaultTest='test_suite')


=== Added File Zope3/lib/python/Zope/App/OFS/Folder/Views/Browser/tests/testFolderContents.py ===
# Copyright (c) 2001 Zope Corporation and Contributors.  All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 1.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS 
# FOR A PARTICULAR PURPOSE.

import unittest

from Zope.App.OFS.Folder.Views.Browser.FolderContents import FolderContents
from Zope.App.OFS.Folder.Folder import Folder
from Zope.App.OFS.Container.Views.Browser.tests.testContents \
     import BaseTestContentsBrowserView

class Test(BaseTestContentsBrowserView, unittest.TestCase):

    def _TestView__newContext(self):
        return Folder()

    def _TestView__newView(self, container):
        return FolderContents(container)

    def testAddServiceManager(self):
        folder = Folder()
        fc = FolderContents(folder)
        fc.addServiceManager()
        self.failUnless(folder.hasServiceManager())
        self.assertRaises('HasServiceManager', fc.addServiceManager)

def test_suite():
    loader = unittest.TestLoader()
    return loader.loadTestsFromTestCase( Test )

if __name__=='__main__':
    unittest.main()


=== Added File Zope3/lib/python/Zope/App/OFS/Folder/Views/Browser/tests/testLoadedFolderContents.py ===
# Copyright (c) 2001 Zope Corporation and Contributors.  All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 1.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS 
# FOR A PARTICULAR PURPOSE.

import unittest

from Zope.App.OFS.Folder.Views.Browser.LoadedFolderContents import \
     LoadedFolderContents
from Zope.App.OFS.Folder.LoadedFolder import LoadedFolder
from Zope.App.OFS.Container.Views.Browser.tests.testContents \
     import BaseTestContentsBrowserView

class Test(BaseTestContentsBrowserView, unittest.TestCase):

    def _TestView__newContext(self):
        return LoadedFolder()

    def _TestView__newView(self, container):
        return LoadedFolderContents(container)

    def testAddServiceManager(self):
        folder = LoadedFolder()
        fc = LoadedFolderContents(folder)
        fc.addServiceManager()
        self.failUnless(folder.hasServiceManager())
        self.assertRaises('HasServiceManager', fc.addServiceManager)

def test_suite():
    loader = unittest.TestLoader()
    return loader.loadTestsFromTestCase( Test )

if __name__=='__main__':
    unittest.main()