@@ -6628,3 +6628,43 @@ func TestController_GetLicense(t *testing.T) {
66286628 require .NotNil (t , resp .JSON501 , "expected HTTP-501 response, got %v" , resp .StatusCode ())
66296629 })
66306630}
6631+
6632+ func TestController_ImportStart_Disabled (t * testing.T ) {
6633+ // set up a server with local imports disabled
6634+ storageLocation := t .TempDir ()
6635+ viper .Set (config .BlockstoreTypeKey , block .BlockstoreTypeLocal )
6636+ viper .Set ("blockstore.local.path" , storageLocation )
6637+ viper .Set ("blockstore.local.import_enabled" , false )
6638+
6639+ clt , deps := setupClientWithAdmin (t )
6640+ ctx := t .Context ()
6641+
6642+ // Create a repository with a unique name for the test
6643+ repo := testUniqueRepoName ()
6644+ createRepoResp , err := clt .CreateRepositoryWithResponse (ctx , & apigen.CreateRepositoryParams {}, apigen.CreateRepositoryJSONRequestBody {
6645+ Name : repo ,
6646+ StorageNamespace : onBlock (deps , "bucket/prefix" ),
6647+ })
6648+ require .NoError (t , err )
6649+ require .NotNil (t , createRepoResp .JSON201 , "expected status 201 Created when creating repo" )
6650+
6651+ // attempt to start an import
6652+ resp , err := clt .ImportStartWithResponse (ctx , repo , "main" , apigen.ImportStartJSONRequestBody {
6653+ Commit : apigen.CommitCreation {
6654+ Message : "test import" ,
6655+ },
6656+ Paths : []apigen.ImportLocation {
6657+ {
6658+ Path : "some/local/path" ,
6659+ Type : "common_prefix" ,
6660+ Destination : "/" ,
6661+ },
6662+ },
6663+ })
6664+
6665+ // verify the request is forbidden
6666+ require .NoError (t , err )
6667+ require .NotNil (t , resp , "response should not be nil" )
6668+ require .NotNil (t , resp .JSON403 , "expected a 403 forbidden response, but got none" )
6669+ require .Contains (t , resp .JSON403 .Message , "import is not supported for this storage namespace" )
6670+ }
0 commit comments