#NEWLINE# @ pytest . mark . django_db #NEWLINE# def test_full_post( ) : #NEWLINE# #INDENT# org = Organization . objects . create ( name = 'United States Executive Branch' , classification = 'executive' , jurisdiction_id = 'jurisdiction-id' ) #NEWLINE# post = ScrapePost ( label = 'executive' , role = 'President' , organization_id = '~{"classification": "executive"}' , start_date = datetime . date ( 2015 , 5 , 18 ) , end_date = '2015-05-19' ) #NEWLINE# post . add_contact_detail ( type = 'phone' , value = '555-555-1234' , note = 'this is fake' ) #NEWLINE# post . add_link ( 'http://example.com/link' ) #NEWLINE# oi = OrganizationImporter ( 'jurisdiction-id' ) #NEWLINE# PostImporter ( 'jurisdiction-id' , oi ) . import_data ( [ post . as_dict ( ) ] ) #NEWLINE# p = Post . objects . get ( ) #NEWLINE# assert ( 'ocd-post' in p . id ) #NEWLINE# assert ( p . label == post . label ) #NEWLINE# assert ( p . role == post . role ) #NEWLINE# assert ( p . organization_id == org . id ) #NEWLINE# assert ( p . contact_details . all ( ) [ 0 ] . type == 'phone' ) #NEWLINE# assert ( p . contact_details . all ( ) [ 0 ] . value == '555-555-1234' ) #NEWLINE# assert ( p . contact_details . all ( ) [ 0 ] . note == 'this is fake' ) #NEWLINE# assert ( p . links . all ( ) [ 0 ] . url == 'http://example.com/link' ) #NEWLINE# assert ( p . start_date == '2015-05-18' ) #NEWLINE# assert ( p . end_date == '2015-05-19' )