فهرست منبع

[api][conf] Refactor API tests and configuration handling (#4181)

- Enhanced the configuration retrieval in the API to include new flags for sharing and usage collection. This fixes bug of hue_config present ClusterConfig getting overridden.
- Removed redundant configuration entries from the ClusterConfig model.
- Reorganized import statements for consistency and clarity.
- Updated test cases to check for all config fields, improve readability and maintainability, including adjustments to JSON handling and assertions.
Harsh Gupta 10 ماه پیش
والد
کامیت
666cf4e6c6
3فایلهای تغییر یافته به همراه328 افزوده شده و 293 حذف شده
  1. 3 0
      desktop/core/src/desktop/api2.py
  2. 325 286
      desktop/core/src/desktop/api2_tests.py
  3. 0 7
      desktop/core/src/desktop/models.py

+ 3 - 0
desktop/core/src/desktop/api2.py

@@ -41,6 +41,7 @@ from beeswax.models import Namespace
 from desktop import appmanager
 from desktop.auth.backend import is_admin
 from desktop.conf import (
+  COLLECT_USAGE,
   CUSTOM,
   ENABLE_CHUNKED_FILE_UPLOADER,
   ENABLE_CONNECTORS,
@@ -148,6 +149,8 @@ def get_config(request):
     'enable_task_server': TASK_SERVER_V2.ENABLED.get(),
     'enable_workflow_creation_action': ENABLE_WORKFLOW_CREATION_ACTION.get(),
     'allow_sample_data_from_views': ALLOW_SAMPLE_DATA_FROM_VIEWS.get(),
+    'enable_sharing': ENABLE_SHARING.get(),
+    'collect_usage': COLLECT_USAGE.get(),
   }
 
   # Storage browser configuration

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 325 - 286
desktop/core/src/desktop/api2_tests.py


+ 0 - 7
desktop/core/src/desktop/models.py

@@ -40,12 +40,10 @@ from desktop import appmanager
 from desktop.auth.backend import is_admin
 from desktop.conf import (
   APP_BLACKLIST,
-  COLLECT_USAGE,
   DISABLE_SOURCE_AUTOCOMPLETE,
   ENABLE_NEW_IMPORTER,
   ENABLE_NEW_STORAGE_BROWSER,
   ENABLE_ORGANIZATIONS,
-  ENABLE_SHARING,
   ENABLE_UNIFIED_ANALYTICS,
   get_clusters,
   has_connectors,
@@ -1803,11 +1801,6 @@ class ClusterConfig(object):
       'default_sql_interpreter': default_sql_interpreter,
       'cluster_type': self.cluster_type,
       'has_computes': self.cluster_type in ('cdw', 'altus', 'snowball'),  # or any grouped engine connectors
-      'hue_config': {
-        'enable_sharing': ENABLE_SHARING.get(),
-        'collect_usage': COLLECT_USAGE.get()
-      },
-      'storage_browser': {},
       'vw_name': hue_host_name,
       'img_version': img_version,
       'hue_version': version_of_hue

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است