#NEWLINE# @ pytest . mark . django_db #NEWLINE# def test_full_organization( ) : #NEWLINE# #INDENT# org = ScrapeOrganization ( 'United Nations' , classification = 'international' ) #NEWLINE# org . add_identifier ( 'un' ) #NEWLINE# org . add_name ( 'UN' , start_date = '1945' ) #NEWLINE# org . add_contact_detail ( type = 'phone' , value = '555-555-1234' , note = 'this is fake' ) #NEWLINE# org . add_link ( 'http://example.com/link' ) #NEWLINE# org . add_source ( 'http://example.com/source' ) #NEWLINE# od = org . as_dict ( ) #NEWLINE# OrganizationImporter ( 'jurisdiction-id' ) . import_data ( [ od ] ) #NEWLINE# o = Organization . objects . get ( ) #NEWLINE# assert ( 'ocd-organization' in o . id ) #NEWLINE# assert ( od . name == org . name ) #NEWLINE# assert ( o . identifiers . all ( ) [ 0 ] . identifier == 'un' ) #NEWLINE# assert ( o . identifiers . all ( ) [ 0 ] . scheme == '' ) #NEWLINE# assert ( o . other_names . all ( ) [ 0 ] . name == 'UN' ) #NEWLINE# assert ( o . other_names . all ( ) [ 0 ] . start_date == '1945' ) #NEWLINE# assert ( o . contact_details . all ( ) [ 0 ] . type == 'phone' ) #NEWLINE# assert ( o . contact_details . all ( ) [ 0 ] . value == '555-555-1234' ) #NEWLINE# assert ( o . contact_details . all ( ) [ 0 ] . note == 'this is fake' ) #NEWLINE# assert ( o . links . all ( ) [ 0 ] . url == 'http://example.com/link' ) #NEWLINE# assert ( o . sources . all ( ) [ 0 ] . url == 'http://example.com/source' )