source: mauRepo/MolesManager/trunk/src/libs/migration/tests/test_utils.py @ 8217

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/mauRepo/MolesManager/trunk/src/libs/migration/tests/test_utils.py@8217
Revision 8217, 2.9 KB checked in by mnagni, 9 years ago (diff)

Incomplete - # 22428: CEDA Project - observationCollection
 http://team.ceda.ac.uk/trac/ceda/ticket/22428

Line 
1'''
2Created on 31 Mar 2012
3
4@author: mnagni
5'''
6from ea_model.ceda_metadatamodel.ceda_observationcollection.ceda_observationcollection import CEDA_ObservationCollection
7from libs.migration.processor.commons import createMD_Identifier,\
8    createCI_Citation, createCI_Individual, createCI_Organization
9from ea_model.ceda_metadatamodel.ceda_observation.ceda_observation import CEDA_Observation
10from ea_model.ceda_metadatamodel.ceda_project.ceda_project import CEDA_Project
11from ea_model.upcomingiso.ci_responsibility import CI_Responsibility
12from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information import ci_rolecode
13from ea_model.upcomingiso.ci_individual import CI_Individual
14
15def createObservationCollection():
16    '''
17        Creates a CEDA_ObservationCollection with the following data:
18        oc.identifier[0].code = 'test_code'
19        oc.identifier[0].authority.title = 'test_title'
20    '''
21    observationCollection = CEDA_ObservationCollection()
22    auth = createCI_Citation('test_title')
23    i_identifier = createMD_Identifier(code = 'test_code', authority=auth)
24    observationCollection.identifier.append(i_identifier)     
25    return observationCollection
26
27def createObservation():
28    '''
29        Creates a CEDA_Observation with the following data:
30        oc.identifier[0].code = 'test_code'       
31        oc.identifier[0].authority.title = 'test_title'
32        oc.identifier[1].code = 'mau_code'       
33        oc.identifier[1].authority.title = 'mau_title'       
34    '''
35    observation = CEDA_Observation()
36    i_identifier = createMD_Identifier(code = 'test_code', authority=createCI_Citation('test_title'))
37    observation.identifier.append(i_identifier)     
38    i_identifier = createMD_Identifier(code = 'mau_code', authority=createCI_Citation('mau_title'))
39    observation.identifier.append(i_identifier) 
40    observation.dataLineage = "test_dataLineage"       
41    return observation
42
43def createCI_Responsibility():
44    '''
45        Creates a CI_Responsibility with the following data:
46        ci_responsibilty.role = 'ci_rolecode.CI_RoleCode.cl_author
47        ci_responsibilty.party[0]
48            CI_Individual.name = 'individual_1'
49        ci_responsibilty.party[1]
50            CI_Organization.name = 'organization_1'
51    '''   
52    ci_responsibilty = CI_Responsibility()
53    ci_responsibilty.role = ci_rolecode.CI_RoleCode.cl_author
54    ci_individual_1 = createCI_Individual('individual_1')
55    ci_responsibilty.party.append(ci_individual_1)
56    ci_organization_1 = createCI_Organization('organization_1')
57    ci_responsibilty.party.append(ci_organization_1)   
58    return ci_responsibilty
59
60def createProject():
61    '''
62        Creates a CEDA_Project with the following data:
63        project.abstract = 'test_abstract'               
64    '''   
65    ceda_project = CEDA_Project()
66    ceda_project.abstract = 'test_abstract' 
67    return ceda_project
Note: See TracBrowser for help on using the repository browser.