1010import pytest
1111import pytz
1212import sqlite3
13- import glob
14- from unittest .mock import patch , Mock
13+ from unittest .mock import patch
1514
16- from unittest .mock import patch , Mock
1715
1816from .. import InvalidProject
1917from ..client import (
@@ -1382,16 +1380,6 @@ def _create_spatial_table(db_file):
13821380 cursor .execute ("COMMIT;" )
13831381
13841382
1385- def _delete_spatial_table (db_file ):
1386- """Drops spatial table called 'test' in sqlite database. Useful to simulate change of database schema."""
1387- con = sqlite3 .connect (db_file )
1388- cursor = con .cursor ()
1389- cursor .execute ("DROP TABLE poi;" )
1390- cursor .execute ("DELETE FROM gpkg_geometry_columns WHERE table_name='poi';" )
1391- cursor .execute ("DELETE FROM gpkg_contents WHERE table_name='poi';" )
1392- cursor .execute ("COMMIT;" )
1393-
1394-
13951383def _check_test_table (db_file ):
13961384 """Checks whether the 'test' table exists and has one row - otherwise fails with an exception."""
13971385 assert _get_table_row_count (db_file , "test" ) == 1
@@ -1401,7 +1389,7 @@ def _get_table_row_count(db_file, table):
14011389 try :
14021390 con_verify = sqlite3 .connect (db_file )
14031391 cursor_verify = con_verify .cursor ()
1404- cursor_verify .execute ("select count(*) from {};" .format (table ))
1392+ cursor_verify .execute ("select count(*) from {};" .format (table )) # nosec B608
14051393 return cursor_verify .fetchone ()[0 ]
14061394 finally :
14071395 cursor_verify .close ()
@@ -3097,7 +3085,7 @@ def test_uploaded_chunks_cache(mc):
30973085
30983086 with open (file , "rb" ) as file_handle :
30993087 data = file_handle .read ()
3100- checksum = hashlib .sha1 ()
3088+ checksum = hashlib .sha1 () # nosec B324 # usedforsecurity=False flag is compatible with python 3.9+
31013089 checksum .update (data )
31023090 checksum_str = checksum .hexdigest ()
31033091 resp = mc .post (f"/v2/projects/{ mp .project_id ()} /chunks" , data , {"Content-Type" : "application/octet-stream" })
0 commit comments