#NEWLINE# def test_post_ois_data_near_match_does_not_update( self , testapp ) : #NEWLINE# #INDENT# ' OIS data with the same ID but different details creates a new record.\n        ' #NEWLINE# department = Department . create ( name = 'Good Police Department' , short_name = 'GPD' , load_defaults = False ) #NEWLINE# ( extractor , envs ) = Extractor . from_department_and_password ( department = department , password = 'password' ) #NEWLINE# testapp . authorization = ( 'Basic' , ( extractor . username , 'password' ) ) #NEWLINE# test_client = JSONTestClient ( ) #NEWLINE# ois_data = test_client . get_prebaked_ois ( last = 1 ) #NEWLINE# response = testapp . post_json ( '/data/OIS' , params = { #NEWLINE# #INDENT# 'month' : 0 , #NEWLINE# 'year' : 0 , #NEWLINE# 'data' : ois_data , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert ( response . status_code == 200 ) #NEWLINE# assert ( response . json_body [ 'updated' ] == 0 ) #NEWLINE# assert ( response . json_body [ 'added' ] == 1 ) #NEWLINE# updated_ois_data = test_client . get_prebaked_ois ( first = 1 , last = 2 ) #NEWLINE# updated_ois_data [ 0 ] [ 'opaqueId' ] = ois_data [ 0 ] [ 'opaqueId' ] #NEWLINE# response = testapp . post_json ( '/data/OIS' , params = { #NEWLINE# #INDENT# 'month' : 0 , #NEWLINE# 'year' : 0 , #NEWLINE# 'data' : updated_ois_data , #NEWLINE# #UNINDENT# } ) #NEWLINE# assert ( response . status_code == 200 ) #NEWLINE# assert ( response . json_body [ 'updated' ] == 0 ) #NEWLINE# assert ( response . json_body [ 'added' ] == 1 ) #NEWLINE# all_ois = OfficerInvolvedShooting . query . all ( ) #NEWLINE# assert ( len ( all_ois ) == 2 )