Changeset 8487 for mauRepo/MolesManager


Ignore:
Timestamp:
06/08/12 17:18:39 (7 years ago)
Author:
mnagni
Message:

Incomplete - # 22534: Add versiojn number to the gui page
 http://team.ceda.ac.uk/trac/ceda/ticket/22534

Location:
mauRepo/MolesManager/trunk/cedaMoles/tests
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/cedaMoles/tests/__init__.py

    r8486 r8487  
    22from cedaMoles.tests.moles2gui.mo.responsiblePartyInfo import ResponsiblePartyInfoTest as rit2  
    33from unittest import TestSuite 
     4from cedaMoles.tests.moles2gui.om.instant import InstantTest 
     5from cedaMoles.tests.moles2gui.om.period import PeriodTest 
     6from cedaMoles.tests.moles2gui.mo.party import PartyTest 
     7from cedaMoles.tests.moles2gui.ceda.observation import ObservationTest 
    48  
    59def suite(): 
     
    711    suite.addTest(rit()) 
    812    suite.addTest(rit2()) 
     13    suite.addTest(InstantTest()) 
     14    suite.addTest(PeriodTest())     
     15    suite.addTest(PartyTest()) 
     16    suite.addTest(ObservationTest())     
     17         
    918    return suite 
    10  
    11  
    12  
  • mauRepo/MolesManager/trunk/cedaMoles/tests/cedamoles/mo/responsiblePartyInfo.py

    r8486 r8487  
    3131@author: mnagni 
    3232''' 
    33 from unittest import TestCase 
    34 from cedaMoles.libs.commons_db import DbManager 
    35 from cedaMoles.libs.migration.MigrationEPB import MigrationEPBFactory 
    36 from cedaMoles.MolesManager.moles3epb import Moles3EPBFactory 
    37 from cedaMoles.libs.migration.InfodbEPB import InfodbEPBFactory 
    38 from cedaMoles.libs.migration.client import EPBRepo 
    39 from cedaMoles.tests.testconfig import MIGRATION_DB_CONNECTION, MIGRATION_DB_SCRIPT,\ 
    40     MOLES3_DB_CONNECTION, MOLES3_DB_SCRIPT, INFO_DB_CONNECTION, EVENTS_DB 
    4133from cedaMoles.libs.migration.processor.commons import createMO_ResponsiblePartyInfo,\ 
    4234    createCI_OnlineResource, createCI_Address, createCI_Telephone,\ 
     
    4638from ea_model.moles3_4.utilities.mo_responsiblepartyinfo import MO_ResponsiblePartyInfo 
    4739from cedaMoles.MolesManager.db.partyIndexes import PartyIndexes, createAssociateIndexes 
     40from cedaMoles.tests.cedamolestest import CedaMolesTest 
    4841 
    4942def _createResponsibleParty(): 
     
    6659    return createMO_ResponsiblePartyInfo(getCLValue(MM_RoleValue.cl_publisher), parties)     
    6760 
    68 class ResponsiblePartyInfoTest(TestCase): 
    69     ''' 
    70     Exploits tests mainly over MO_ResponsiblePartyInfo instances.  
    71     ''' 
    72      
    73     initialized = False 
    74     epbRepo =None 
    75      
    76     def setUp(self): 
    77         if ResponsiblePartyInfoTest.initialized: 
    78             return 
    79                  
    80         migrationDB = DbManager(MIGRATION_DB_CONNECTION, MIGRATION_DB_SCRIPT, sql_echo=True)       
    81         molesDB = DbManager(MOLES3_DB_CONNECTION, MOLES3_DB_SCRIPT, sql_echo=True, session_event_manager=EVENTS_DB)                          
    82         infoDB = DbManager(INFO_DB_CONNECTION) 
    83                  
    84         infoFactory = InfodbEPBFactory(infoDB)         
    85         moles3Factory = Moles3EPBFactory(molesDB) 
    86         migrationFactory = MigrationEPBFactory(migrationDB) 
    87  
    88         ResponsiblePartyInfoTest.epbRepo = EPBRepo(moles3Factory.createEPB() , \ 
    89                                migrationFactory.createEPB(), \ 
    90                                infoFactory.createEPB()) 
    91  
    92         ResponsiblePartyInfoTest.initialized = True 
    93  
    94  
    95     def tearDown(self): 
    96         pass 
    97  
    98  
    99  
     61class ResponsiblePartyInfoTest(CedaMolesTest): 
    10062 
    10163    def testCreationAndDelete(self): 
     
    10971        '''    
    11072        rp = _createResponsibleParty() 
    111         ResponsiblePartyInfoTest.epbRepo.moles3EPB.persistInstance(rp) 
     73        self.epbRepo.moles3EPB.persistInstance(rp) 
    11274        self.assertTrue(len(rp.party) == 2, "Error") 
    11375        self.assertEqual(rp.role, getCLValue(MM_RoleValue.cl_publisher), "Error") 
     
    12183        #----------------------------- 
    12284        rpid = getattr(rp, 'id') 
    123         ResponsiblePartyInfoTest.epbRepo.moles3EPB.deleteInstance(rp) 
     85        self.epbRepo.moles3EPB.deleteInstance(rp) 
    12486        self.assertEqual(self.epbRepo.moles3EPB.search(MO_ResponsiblePartyInfo, rpid), None, "Error") 
    12587        #----------------------------- 
     
    12789        # Verifies that the underlying parties has been deleted 
    12890        #---------------------------------------------------- 
    129         res = ResponsiblePartyInfoTest.epbRepo.moles3EPB.search(MO_Organisation, partyIds[0]) 
     91        res = self.epbRepo.moles3EPB.search(MO_Organisation, partyIds[0]) 
    13092        self.assertTrue(res.id in partyIds, "Error") 
    13193        res = self.epbRepo.moles3EPB.search(MO_Organisation, partyIds[1]) 
     
    155117        pi.id = None 
    156118        try:         
    157             ResponsiblePartyInfoTest.epbRepo.moles3EPB.persistInstance(pi) 
     119            self.epbRepo.moles3EPB.persistInstance(pi) 
    158120            self.fail("PartyIndexes.id cannot be None - PrimaryKey Error") 
    159121        except: 
    160             ResponsiblePartyInfoTest.epbRepo.moles3EPB.rollback() 
     122            self.epbRepo.moles3EPB.rollback() 
    161123        #----------------------------------- 
    162124         
     
    164126        pi.id = 100 
    165127        try: 
    166             ResponsiblePartyInfoTest.epbRepo.moles3EPB.persistInstance(pi) 
     128            self.epbRepo.moles3EPB.persistInstance(pi) 
    167129            self.fail("PartyIndexes.id has not associated MO_REsponsiblePartyInfo - ForeignKey Error") 
    168130        except: 
    169             ResponsiblePartyInfoTest.epbRepo.moles3EPB.rollback() 
     131            self.epbRepo.moles3EPB.rollback() 
    170132        #----------------------------------- 
    171133         
    172134        #------------ Test 3 --------------- 
    173         ResponsiblePartyInfoTest.epbRepo.moles3EPB.persistInstance(rp) 
     135        self.epbRepo.moles3EPB.persistInstance(rp) 
    174136        pi.id = getattr(rp, 'id') 
    175137        try: 
    176             ResponsiblePartyInfoTest.epbRepo.moles3EPB.persistInstance(pi) 
     138            self.epbRepo.moles3EPB.persistInstance(pi) 
    177139            self.fail("PartyIndexes.id has not associated MO_REsponsiblePartyInfo - ForeignKey Error") 
    178140        except Exception as e: 
    179             ResponsiblePartyInfoTest.epbRepo.moles3EPB.rollback() 
     141            self.epbRepo.moles3EPB.rollback() 
    180142        #----------------------------------- 
    181143         
    182144        #------------ Test 4 --------------- 
    183145        resId = getattr(rp, 'id') 
    184         ResponsiblePartyInfoTest.epbRepo.moles3EPB.expunge(rp) 
    185         res = ResponsiblePartyInfoTest.epbRepo.moles3EPB.search(MO_ResponsiblePartyInfo, resId) 
     146        self.epbRepo.moles3EPB.expunge(rp) 
     147        res = self.epbRepo.moles3EPB.search(MO_ResponsiblePartyInfo, resId) 
    186148        for party in res.party: 
    187149            self.assertTrue(party.party_order > -1, "MO_Party.party_order is not assigned - Error") 
     
    189151         
    190152        #------------ Test 5 --------------- 
    191         ResponsiblePartyInfoTest.epbRepo.moles3EPB.deleteInstance(res) 
    192         pi = ResponsiblePartyInfoTest.epbRepo.moles3EPB.search(PartyIndexes, resId) 
     153        self.epbRepo.moles3EPB.deleteInstance(res) 
     154        pi = self.epbRepo.moles3EPB.search(PartyIndexes, resId) 
    193155        self.assertTrue(pi is None, "PartyIndexes is not deleted after MO_ResponsiblePartyInfo is deleted - Error") 
    194156        #----------------------------------- 
  • mauRepo/MolesManager/trunk/cedaMoles/tests/moles2gui/ceda/observation.py

    r8486 r8487  
    3838 
    3939 
    40 class Test(unittest.TestCase): 
     40class ObservationTest(unittest.TestCase): 
    4141 
    4242 
  • mauRepo/MolesManager/trunk/cedaMoles/tests/moles2gui/mo/party.py

    r8486 r8487  
    3838 
    3939 
    40 class Test(unittest.TestCase): 
     40class PartyTest(unittest.TestCase): 
    4141 
    4242 
  • mauRepo/MolesManager/trunk/cedaMoles/tests/moles2gui/om/instant.py

    r8486 r8487  
    3838 
    3939 
    40 class Test(unittest.TestCase): 
     40class InstantTest(unittest.TestCase): 
    4141 
    4242 
  • mauRepo/MolesManager/trunk/cedaMoles/tests/moles2gui/om/period.py

    r8486 r8487  
    3838 
    3939 
    40 class Test(unittest.TestCase): 
     40class PeriodTest(unittest.TestCase): 
    4141 
    4242 
Note: See TracChangeset for help on using the changeset viewer.