@@ -1889,10 +1889,14 @@ def _row_data(row):
18891889 'joined' : joined }
18901890
18911891 SENT = {
1892- 'rows' : [{'json' : _row_data (row )} for row in ROWS ],
1892+ 'rows' : [{
1893+ 'json' : _row_data (row ),
1894+ 'insertId' : str (i ),
1895+ } for i , row in enumerate (ROWS )],
18931896 }
18941897
1895- errors = client .create_rows (table , ROWS )
1898+ with mock .patch ('uuid.uuid4' , side_effect = map (str , range (len (ROWS )))):
1899+ errors = client .create_rows (table , ROWS )
18961900
18971901 self .assertEqual (len (errors ), 0 )
18981902 self .assertEqual (len (conn ._requested ), 1 )
@@ -1950,10 +1954,14 @@ def _row_data(row):
19501954 return row
19511955
19521956 SENT = {
1953- 'rows' : [{'json' : _row_data (row )} for row in ROWS ],
1957+ 'rows' : [{
1958+ 'json' : _row_data (row ),
1959+ 'insertId' : str (i ),
1960+ } for i , row in enumerate (ROWS )],
19541961 }
19551962
1956- errors = client .create_rows (table , ROWS )
1963+ with mock .patch ('uuid.uuid4' , side_effect = map (str , range (len (ROWS )))):
1964+ errors = client .create_rows (table , ROWS )
19571965
19581966 self .assertEqual (len (errors ), 0 )
19591967 self .assertEqual (len (conn ._requested ), 1 )
@@ -1990,10 +1998,14 @@ def _row_data(row):
19901998 return {'full_name' : row [0 ], 'age' : str (row [1 ])}
19911999
19922000 SENT = {
1993- 'rows' : [{'json' : _row_data (row )} for row in ROWS ],
2001+ 'rows' : [{
2002+ 'json' : _row_data (row ),
2003+ 'insertId' : str (i ),
2004+ } for i , row in enumerate (ROWS )],
19942005 }
19952006
1996- errors = client .create_rows (table , ROWS )
2007+ with mock .patch ('uuid.uuid4' , side_effect = map (str , range (len (ROWS )))):
2008+ errors = client .create_rows (table , ROWS )
19972009
19982010 self .assertEqual (len (errors ), 0 )
19992011 self .assertEqual (len (conn ._requested ), 1 )
@@ -2095,10 +2107,14 @@ def _row_data(row):
20952107 'struct' : row [1 ]}
20962108
20972109 SENT = {
2098- 'rows' : [{'json' : _row_data (row )} for row in ROWS ],
2110+ 'rows' : [{
2111+ 'json' : _row_data (row ),
2112+ 'insertId' : str (i ),
2113+ } for i , row in enumerate (ROWS )],
20992114 }
21002115
2101- errors = client .create_rows (table , ROWS )
2116+ with mock .patch ('uuid.uuid4' , side_effect = map (str , range (len (ROWS )))):
2117+ errors = client .create_rows (table , ROWS )
21022118
21032119 self .assertEqual (len (errors ), 0 )
21042120 self .assertEqual (len (conn ._requested ), 1 )
@@ -2138,11 +2154,15 @@ def _row_data(row):
21382154 'phone' : row [1 ]}
21392155
21402156 SENT = {
2141- 'rows' : [{'json' : _row_data (row )} for row in ROWS ],
2157+ 'rows' : [{
2158+ 'json' : _row_data (row ),
2159+ 'insertId' : str (i ),
2160+ } for i , row in enumerate (ROWS )],
21422161 }
21432162
2144- errors = client .create_rows (self .TABLE_REF , ROWS ,
2145- selected_fields = [full_name , phone ])
2163+ with mock .patch ('uuid.uuid4' , side_effect = map (str , range (len (ROWS )))):
2164+ errors = client .create_rows (self .TABLE_REF , ROWS ,
2165+ selected_fields = [full_name , phone ])
21462166
21472167 self .assertEqual (len (errors ), 0 )
21482168 self .assertEqual (len (conn ._requested ), 1 )
0 commit comments