[zh2311] Remove auth (#2427)

* remove auth

* Remove all auth code

zh2311

* lint

* remove auth from e2e tests conf
This commit is contained in:
Ben MR
2021-09-17 18:47:52 +00:00
committed by GitHub
parent a239d8636d
commit 69e159916e
27 changed files with 28 additions and 509 deletions
@@ -33,7 +33,6 @@ class ConfigTests(unittest.TestCase):
force_https="false",
flask_secret_key="secret",
generate_cache_control_headers="false",
auth_type="session",
insecure_test_environment="false",
index="false",
allowed_matrix_types=[],
@@ -69,7 +68,6 @@ class ConfigTests(unittest.TestCase):
force_https="false",
flask_secret_key="secret",
generate_cache_control_headers="false",
auth_type="session",
index="false",
allowed_matrix_types=[],
max_cached_datasets=5,
@@ -85,7 +83,6 @@ class ConfigTests(unittest.TestCase):
diffexp_cellcount_max="null",
scripts=[],
inline_scripts=[],
authentication_enable="true",
max_categories=1000,
custom_colors="true",
enable_users_annotations="true",
@@ -117,7 +114,6 @@ class ConfigTests(unittest.TestCase):
force_https=force_https,
flask_secret_key=flask_secret_key,
generate_cache_control_headers=generate_cache_control_headers,
auth_type=auth_type,
index=index,
allowed_matrix_types=allowed_matrix_types,
max_cached_datasets=max_cached_datasets,
@@ -136,7 +132,6 @@ class ConfigTests(unittest.TestCase):
dataset_config = self.custom_dataset_config(
scripts=scripts,
inline_scripts=inline_scripts,
authentication_enable=authentication_enable,
max_categories=max_categories,
custom_colors=custom_colors,
enable_users_annotations=enable_users_annotations,
@@ -172,7 +167,6 @@ class ConfigTests(unittest.TestCase):
self,
scripts=[],
inline_scripts=[],
authentication_enable="true",
max_categories=1000,
custom_colors="true",
enable_users_annotations="true",
@@ -46,7 +46,7 @@ class TestDatasetConfig(ConfigTests):
mock_check_attrs.side_effect = BaseConfig.validate_correct_type_of_configuration_attribute()
self.dataset_config.complete_config(self.context)
self.assertIsNotNone(self.config.server_config.data_adaptor)
self.assertEqual(mock_check_attrs.call_count, 17)
self.assertEqual(mock_check_attrs.call_count, 16)
def test_app_sets_script_vars(self):
config = self.get_config(scripts=["path/to/script"])
@@ -71,26 +71,16 @@ class TestDatasetConfig(ConfigTests):
with self.assertRaises(ConfigurationError):
config.dataset_config.handle_app()
def test_handle_user_annotations_ensures_auth_is_enabled_with_valid_auth_type(self):
config = self.get_config(enable_users_annotations="true", authentication_enable="false")
config.server_config.complete_config(self.context)
with self.assertRaises(ConfigurationError):
config.dataset_config.handle_user_annotations(self.context)
config = self.get_config(enable_users_annotations="true", authentication_enable="true", auth_type="pretend")
with self.assertRaises(ConfigurationError):
config.server_config.complete_config(self.context)
def test_handle_user_annotations__instantiates_user_annotations_class_correctly(self):
config = self.get_config(
enable_users_annotations="true", authentication_enable="true", annotation_type="local_file_csv"
enable_users_annotations="true", annotation_type="local_file_csv"
)
config.server_config.complete_config(self.context)
config.dataset_config.handle_user_annotations(self.context)
self.assertIsInstance(config.dataset_config.user_annotations, AnnotationsLocalFile)
config = self.get_config(
enable_users_annotations="true", authentication_enable="true", annotation_type="NOT_REAL"
enable_users_annotations="true", annotation_type="NOT_REAL"
)
config.server_config.complete_config(self.context)
with self.assertRaises(ConfigurationError):
@@ -98,7 +88,7 @@ class TestDatasetConfig(ConfigTests):
def test_handle_local_file_csv_annotations__sets_dir_if_not_passed_in(self):
config = self.get_config(
enable_users_annotations="true", authentication_enable="true", annotation_type="local_file_csv"
enable_users_annotations="true", annotation_type="local_file_csv"
)
config.server_config.complete_config(self.context)
config.dataset_config.handle_local_file_csv_annotations(self.context)
@@ -49,7 +49,7 @@ class TestServerConfig(ConfigTests):
def test_complete_config_checks_all_attr(self, mock_check_attrs):
mock_check_attrs.side_effect = BaseConfig.validate_correct_type_of_configuration_attribute()
self.server_config.complete_config(self.context)
self.assertEqual(mock_check_attrs.call_count, 21)
self.assertEqual(mock_check_attrs.call_count, 19)
def test_handle_app__throws_error_if_port_doesnt_exist(self):
config = self.get_config(port=99999999)
@@ -111,12 +111,3 @@ class TestServerConfig(ConfigTests):
config.update_from_config_file(file_name)
with self.assertRaises(ConfigurationError):
config.server_config.handle_single_dataset(self.context)
def test_test_auth_only_in_insecure(self):
config = self.get_config(auth_type="test")
with self.assertRaises(ConfigurationError):
config.complete_config()
config.update_server_config(authentication__insecure_test_environment=True)
config.complete_config()