import os, sys
if __name__ == '__main__':
    execfile(os.path.join(sys.path[0], 'framework.py'))

from Testing import ZopeTestCase
ZopeTestCase.installProduct('Reportek')

#from Products.Reportek.Collection import Collection

class CollectionTestCase(ZopeTestCase.ZopeTestCase):

#    def testCreation(self):
#        """ Check for the correct creation of a collection """
#        self.i = Collection('collection', 'TestTitle', 
#        '2003', '2004', '','http://rod.eionet.eu.int/localities/1',
#        'test locality',
#        'Test description')
#        assert self.i, 'Collection not created'

    def testAddCollection(self):
        #self.folder.addDTMLMethod('doc', file='foo')
        # title, descr,year, endyear, partofyear, country, locality,
        # dataflow_uris,allow_collections=0, allow_envelopes=0, id='', REQUEST=None
        self.app.manage_addProduct['Reportek'].manage_addCollection('TestTitle', 'Desc',
            '2003', '2004', '', 'http://rod.eionet.eu.int/localities/1', '', [],
            allow_collections=1, allow_envelopes=1, id='colle')
        self.assertTrue(hasattr(self.app, 'colle'),'Collection did not get created')
        self.assertNotEqual(self.app.colle, None)

def test_suite():
    from unittest import TestSuite, makeSuite
    suite = TestSuite()
    suite.addTest(makeSuite(CollectionTestCase))
    return suite

if __name__ == '__main__':
    framework()
