@@ -226,47 +226,45 @@ def test_rename_batch_mode(self, mock_ee_initialize, temp_dir, mock_argv):
226226class TestQuotaCommand :
227227 """Test quota command."""
228228
229- def test_quota_no_project (self , mock_ee_initialize , mock_argv , mock_google_credentials ):
229+ def test_quota_no_project (self , mock_ee_initialize , mock_argv ):
230230 """Test quota display without specific project."""
231- with patch ('geeup.quota.ee.data.get_persistent_credentials' , return_value = mock_google_credentials ):
232- with patch ('geeup.quota.fetch_quota_data' ) as mock_fetch :
233- mock_fetch .return_value = {
234- 'users/test' : {
235- 'quota' : {
236- 'sizeBytes' : '1000000' ,
237- 'maxSizeBytes' : '10000000' ,
238- 'assetCount' : '10' ,
239- 'maxAssets' : '100'
240- }
231+ with patch ('geeup.quota.fetch_quota_data' ) as mock_fetch :
232+ mock_fetch .return_value = {
233+ 'users/test' : {
234+ 'quota' : {
235+ 'sizeBytes' : '1000000' ,
236+ 'maxSizeBytes' : '10000000' ,
237+ 'assetCount' : '10' ,
238+ 'maxAssets' : '100'
241239 }
242240 }
243- with patch ('sys.argv' , ['geeup' , 'quota' ]):
244- from geeup .geeup import main
245- try :
246- main ()
247- except SystemExit :
248- pass
241+ }
242+ with patch ('sys.argv' , ['geeup' , 'quota' ]):
243+ from geeup .geeup import main
244+ try :
245+ main ()
246+ except SystemExit :
247+ pass
249248
250- def test_quota_specific_project (self , mock_ee_initialize , mock_argv , mock_google_credentials ):
249+ def test_quota_specific_project (self , mock_ee_initialize , mock_argv ):
251250 """Test quota for specific project."""
252- with patch ('geeup.quota.ee.data.get_persistent_credentials' , return_value = mock_google_credentials ):
253- with patch ('geeup.quota.fetch_quota_data' ) as mock_fetch :
254- mock_fetch .return_value = {
255- 'projects/test' : {
256- 'quota' : {
257- 'sizeBytes' : '5000000000' ,
258- 'maxSizeBytes' : '10000000000' ,
259- 'assetCount' : '50' ,
260- 'maxAssets' : '1000'
261- }
251+ with patch ('geeup.quota.fetch_quota_data' ) as mock_fetch :
252+ mock_fetch .return_value = {
253+ 'projects/test' : {
254+ 'quota' : {
255+ 'sizeBytes' : '5000000000' ,
256+ 'maxSizeBytes' : '10000000000' ,
257+ 'assetCount' : '50' ,
258+ 'maxAssets' : '1000'
262259 }
263260 }
264- with patch ('sys.argv' , ['geeup' , 'quota' , '--project' , 'projects/test' ]):
265- from geeup .geeup import main
266- try :
267- main ()
268- except SystemExit :
269- pass
261+ }
262+ with patch ('sys.argv' , ['geeup' , 'quota' , '--project' , 'projects/test' ]):
263+ from geeup .geeup import main
264+ try :
265+ main ()
266+ except SystemExit :
267+ pass
270268
271269
272270class TestZipshapeCommand :
@@ -467,7 +465,7 @@ def test_delete_asset_failure(self, mock_ee_initialize, mock_argv):
467465class TestUploadCommand :
468466 """Test upload commands."""
469467
470- def test_upload_basic (self , mock_ee_initialize , temp_dir , mock_argv , mock_google_credentials ):
468+ def test_upload_basic (self , mock_ee_initialize , temp_dir , mock_argv ):
471469 """Test basic image upload."""
472470 source_dir = temp_dir / "source"
473471 source_dir .mkdir ()
@@ -479,24 +477,21 @@ def test_upload_basic(self, mock_ee_initialize, temp_dir, mock_argv, mock_google
479477 metadata_file = temp_dir / "metadata.csv"
480478 metadata_file .write_text ("system:index\n test_image" )
481479
482- with patch ('geeup.batch_uploader.ee.data.get_persistent_credentials' , return_value = mock_google_credentials ):
483- with patch ('geeup.batch_uploader.upload' ) as mock_upload :
484- with patch ('sys.argv' , [
485- 'geeup' , 'upload' ,
486- '--source' , str (source_dir ),
487- '--dest' , 'users/test/collection' ,
488- '--metadata' , str (metadata_file ),
489- '--user' , 'test@example.com'
490- ]):
491- from geeup .geeup import main
492- try :
493- main ()
494- except SystemExit :
495- pass
496- # Upload should be called if validation passes
497- # With no actual GDAL, it may not be called
480+ with patch ('sys.argv' , [
481+ 'geeup' , 'upload' ,
482+ '--source' , str (source_dir ),
483+ '--dest' , 'users/test/collection' ,
484+ '--metadata' , str (metadata_file ),
485+ '--user' , 'test@example.com'
486+ ]):
487+ from geeup .geeup import main
488+ try :
489+ main ()
490+ except SystemExit :
491+ pass
492+ # Validation may fail, which is expected
498493
499- def test_upload_with_options (self , mock_ee_initialize , temp_dir , mock_argv , mock_google_credentials ):
494+ def test_upload_with_options (self , mock_ee_initialize , temp_dir , mock_argv ):
500495 """Test upload with additional options."""
501496 source_dir = temp_dir / "source"
502497 source_dir .mkdir ()
@@ -508,30 +503,29 @@ def test_upload_with_options(self, mock_ee_initialize, temp_dir, mock_argv, mock
508503 metadata_file = temp_dir / "metadata.csv"
509504 metadata_file .write_text ("system:index\n test_image" )
510505
511- with patch ('geeup.batch_uploader.ee.data.get_persistent_credentials' , return_value = mock_google_credentials ):
512- with patch ('geeup.batch_uploader.upload' ) as mock_upload :
513- with patch ('sys.argv' , [
514- 'geeup' , 'upload' ,
515- '--source' , str (source_dir ),
516- '--dest' , 'users/test/collection' ,
517- '--metadata' , str (metadata_file ),
518- '--user' , 'test@example.com' ,
519- '--nodata' , '0' ,
520- '--pyramids' , 'MEAN' ,
521- '--workers' , '2' ,
522- '--dry-run'
523- ]):
524- from geeup .geeup import main
525- try :
526- main ()
527- except SystemExit :
528- pass
506+ with patch ('sys.argv' , [
507+ 'geeup' , 'upload' ,
508+ '--source' , str (source_dir ),
509+ '--dest' , 'users/test/collection' ,
510+ '--metadata' , str (metadata_file ),
511+ '--user' , 'test@example.com' ,
512+ '--nodata' , '0' ,
513+ '--pyramids' , 'MEAN' ,
514+ '--workers' , '2' ,
515+ '--dry-run'
516+ ]):
517+ from geeup .geeup import main
518+ try :
519+ main ()
520+ except SystemExit :
521+ pass
522+ # Validation may fail, which is expected
529523
530524
531525class TestTabupCommand :
532526 """Test table upload commands."""
533527
534- def test_tabup_basic (self , mock_ee_initialize , temp_dir , mock_argv , mock_google_credentials ):
528+ def test_tabup_basic (self , mock_ee_initialize , temp_dir , mock_argv ):
535529 """Test basic table upload."""
536530 source_dir = temp_dir / "source"
537531 source_dir .mkdir ()
@@ -540,21 +534,20 @@ def test_tabup_basic(self, mock_ee_initialize, temp_dir, mock_argv, mock_google_
540534 test_csv = source_dir / "test_table.csv"
541535 test_csv .write_text ("id,name\n 1,test" )
542536
543- with patch ('geeup.tuploader.ee.data.get_persistent_credentials' , return_value = mock_google_credentials ):
544- with patch ('geeup.tuploader.tabup' ) as mock_tabup :
545- with patch ('sys.argv' , [
546- 'geeup' , 'tabup' ,
547- '--source' , str (source_dir ),
548- '--dest' , 'users/test/folder' ,
549- '--user' , 'test@example.com'
550- ]):
551- from geeup .geeup import main
552- try :
553- main ()
554- except SystemExit :
555- pass
537+ with patch ('sys.argv' , [
538+ 'geeup' , 'tabup' ,
539+ '--source' , str (source_dir ),
540+ '--dest' , 'users/test/folder' ,
541+ '--user' , 'test@example.com'
542+ ]):
543+ from geeup .geeup import main
544+ try :
545+ main ()
546+ except SystemExit :
547+ pass
548+ # Validation may fail, which is expected
556549
557- def test_tabup_with_coordinates (self , mock_ee_initialize , temp_dir , mock_argv , mock_google_credentials ):
550+ def test_tabup_with_coordinates (self , mock_ee_initialize , temp_dir , mock_argv ):
558551 """Test table upload with coordinate columns."""
559552 source_dir = temp_dir / "source"
560553 source_dir .mkdir ()
@@ -563,21 +556,20 @@ def test_tabup_with_coordinates(self, mock_ee_initialize, temp_dir, mock_argv, m
563556 test_csv = source_dir / "test_table.csv"
564557 test_csv .write_text ("id,longitude,latitude\n 1,0.0,0.0" )
565558
566- with patch ('geeup.tuploader.ee.data.get_persistent_credentials' , return_value = mock_google_credentials ):
567- with patch ('geeup.tuploader.tabup' ) as mock_tabup :
568- with patch ('sys.argv' , [
569- 'geeup' , 'tabup' ,
570- '--source' , str (source_dir ),
571- '--dest' , 'users/test/folder' ,
572- '--user' , 'test@example.com' ,
573- '--x' , 'longitude' ,
574- '--y' , 'latitude'
575- ]):
576- from geeup .geeup import main
577- try :
578- main ()
579- except SystemExit :
580- pass
559+ with patch ('sys.argv' , [
560+ 'geeup' , 'tabup' ,
561+ '--source' , str (source_dir ),
562+ '--dest' , 'users/test/folder' ,
563+ '--user' , 'test@example.com' ,
564+ '--x' , 'longitude' ,
565+ '--y' , 'latitude'
566+ ]):
567+ from geeup .geeup import main
568+ try :
569+ main ()
570+ except SystemExit :
571+ pass
572+ # Validation may fail, which is expected
581573
582574
583575class TestIntegration :
0 commit comments