Changeset 5147 for ndgCommon/trunk


Ignore:
Timestamp:
30/03/09 15:06:59 (10 years ago)
Author:
cbyrom
Message:

Add new tests and test constants.

Location:
ndgCommon/trunk/ndg/common
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/src/models/abstractrecord.py

    r5144 r5147  
    136136        return tree 
    137137 
     138 
    138139    def getRecordTypeName(self): 
    139140        ''' 
  • ndgCommon/trunk/ndg/common/unittests/clients/http/testvocabserverclient.py

    r5117 r5147  
    6666        self.assertEquals(tc.SN_LIST_LONG_NAME, info.listLongName) 
    6767        self.assertEquals(tc.SN_LIST_SHORT_NAME, info.listShortName) 
     68         
     69    def testSearchVocabTerm(self): 
     70        records = self.client.searchVocabTerm(tc.STANDARD_NAMES_LIST, tc.VALID_SEARCH_TERM) 
     71        self.assertTrue(len(records) > 0) 
     72        for record in records: 
     73            self.assertTrue(record.entryTerm.find(tc.VALID_SEARCH_TEXT) > -1) 
     74         
     75    def testInvalidSearchVocabTerm(self): 
     76        records = self.client.searchVocabTerm(tc.STANDARD_NAMES_LIST, tc.INVALID_SEARCH_TERM) 
     77        self.assertEquals([], records) 
     78         
     79         
    6880 
  • ndgCommon/trunk/ndg/common/unittests/models/testcodetablerecord.py

    r5117 r5147  
    8888 
    8989 
     90    def testGetRecordTypeName(self): 
     91        self.assertEquals('Code Table Record', self.ctr.getRecordTypeName()) 
  • ndgCommon/trunk/ndg/common/unittests/models/testcodetabletype.py

    r5097 r5147  
    6767        self.assertNotEquals('', self.ctt.listVersion) 
    6868        self.assertNotEquals('', self.ctt.listLastMod) 
     69 
     70 
     71    def testGetRecordTypeName(self): 
     72        self.assertEquals('Code Table Type', self.ctt.getRecordTypeName()) 
  • ndgCommon/trunk/ndg/common/unittests/testconstants.py

    r5106 r5147  
    1414 
    1515from ndg.common.src.models.vocabtermdata import VocabTermData as VTD 
     16from ndg.common.src.models.codetablerecord import CodeTableRecord 
    1617import os, datetime 
    1718 
     
    211212STANDARD_NAMES_LIST = "http://vocab.ndg.nerc.ac.uk/list/P071/11" 
    212213STANDARD_NAME_TERM = "http://vocab.ndg.nerc.ac.uk/term/P071/11/CFSN0012" 
     214VALID_SEARCH_TEXT = "temperature" 
     215VALID_SEARCH_TERM = "*%s*" %VALID_SEARCH_TEXT 
     216INVALID_SEARCH_TERM = "space_monkeys" 
    213217SN_TERM_NAME = "aerosol_angstrom_exponent" 
    214218SN_ABBREV = "" 
    215219SN_DEF = "'Aerosol' means the suspended liquid or solid particles in air (except cloud droplets)." 
     220SN_DEF_2 = "blah" 
    216221SN_MOD_DATE = "2006-09-26T17:12:43.000+00:00" 
    217222SN_LIST_MOD_DATE = "2008-11-11T16:08:00.000+00:00" 
     
    221226SN_LIST_SHORT_NAME = "CF Standard Names" 
    222227SN_LIST_MAIL_GROUP = "test@test.com" 
     228 
     229CODE_TABLE_RECORD_1 = CodeTableRecord() 
     230CODE_TABLE_RECORD_1.setData(STANDARD_NAMES_LIST, SN_TERM_NAME, SN_TERM_NAME,  
     231                            SN_ABBREV, SN_DEF, SN_MOD_DATE) 
     232CODE_TABLE_RECORD_2 = CodeTableRecord() 
     233CODE_TABLE_RECORD_2.setData(STANDARD_NAMES_LIST, SN_TERM_NAME, SN_TERM_NAME,  
     234                            SN_ABBREV, SN_DEF_2, SN_MOD_DATE) 
Note: See TracChangeset for help on using the changeset viewer.