cornflow 2.0.0a10__py3-none-any.whl → 2.0.0a12__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. airflow_config/airflow_local_settings.py +1 -1
  2. cornflow/app.py +8 -3
  3. cornflow/cli/migrations.py +23 -3
  4. cornflow/cli/service.py +18 -18
  5. cornflow/cli/utils.py +16 -1
  6. cornflow/commands/dag.py +1 -1
  7. cornflow/config.py +13 -8
  8. cornflow/endpoints/__init__.py +8 -2
  9. cornflow/endpoints/alarms.py +66 -2
  10. cornflow/endpoints/data_check.py +53 -26
  11. cornflow/endpoints/execution.py +387 -132
  12. cornflow/endpoints/login.py +81 -63
  13. cornflow/endpoints/meta_resource.py +11 -3
  14. cornflow/migrations/versions/999b98e24225.py +34 -0
  15. cornflow/models/base_data_model.py +4 -32
  16. cornflow/models/execution.py +2 -3
  17. cornflow/models/meta_models.py +28 -22
  18. cornflow/models/user.py +7 -10
  19. cornflow/schemas/alarms.py +8 -0
  20. cornflow/schemas/execution.py +1 -1
  21. cornflow/schemas/query.py +2 -1
  22. cornflow/schemas/user.py +5 -20
  23. cornflow/shared/authentication/auth.py +201 -264
  24. cornflow/shared/const.py +3 -14
  25. cornflow/shared/databricks.py +5 -1
  26. cornflow/tests/const.py +1 -0
  27. cornflow/tests/custom_test_case.py +77 -26
  28. cornflow/tests/unit/test_actions.py +2 -2
  29. cornflow/tests/unit/test_alarms.py +55 -1
  30. cornflow/tests/unit/test_apiview.py +108 -3
  31. cornflow/tests/unit/test_cases.py +20 -29
  32. cornflow/tests/unit/test_cli.py +6 -5
  33. cornflow/tests/unit/test_commands.py +3 -3
  34. cornflow/tests/unit/test_dags.py +5 -6
  35. cornflow/tests/unit/test_executions.py +443 -123
  36. cornflow/tests/unit/test_instances.py +14 -2
  37. cornflow/tests/unit/test_instances_file.py +1 -1
  38. cornflow/tests/unit/test_licenses.py +1 -1
  39. cornflow/tests/unit/test_log_in.py +230 -207
  40. cornflow/tests/unit/test_permissions.py +8 -8
  41. cornflow/tests/unit/test_roles.py +48 -10
  42. cornflow/tests/unit/test_schemas.py +1 -1
  43. cornflow/tests/unit/test_tables.py +7 -7
  44. cornflow/tests/unit/test_token.py +19 -5
  45. cornflow/tests/unit/test_users.py +22 -6
  46. cornflow/tests/unit/tools.py +75 -10
  47. {cornflow-2.0.0a10.dist-info → cornflow-2.0.0a12.dist-info}/METADATA +16 -15
  48. {cornflow-2.0.0a10.dist-info → cornflow-2.0.0a12.dist-info}/RECORD +51 -51
  49. {cornflow-2.0.0a10.dist-info → cornflow-2.0.0a12.dist-info}/WHEEL +1 -1
  50. cornflow/endpoints/execution_databricks.py +0 -808
  51. {cornflow-2.0.0a10.dist-info → cornflow-2.0.0a12.dist-info}/entry_points.txt +0 -0
  52. {cornflow-2.0.0a10.dist-info → cornflow-2.0.0a12.dist-info}/top_level.txt +0 -0
@@ -16,6 +16,7 @@ from cornflow.tests.const import (
16
16
  INSTANCE_URL,
17
17
  INSTANCES_LIST,
18
18
  INSTANCE_PATH,
19
+ EMPTY_INSTANCE_PATH
19
20
  )
20
21
  from cornflow.tests.custom_test_case import CustomTestCase, BaseTestCases
21
22
  from flask import current_app
@@ -35,6 +36,7 @@ class TestInstancesListEndpoint(BaseTestCases.ListFilters):
35
36
  return temp
36
37
 
37
38
  self.payload = load_file(INSTANCE_PATH)
39
+ self.payload2 = load_file(EMPTY_INSTANCE_PATH)
38
40
  self.payloads = [load_file(f) for f in INSTANCES_LIST]
39
41
  self.keys_to_check = [
40
42
  "data_hash",
@@ -49,6 +51,16 @@ class TestInstancesListEndpoint(BaseTestCases.ListFilters):
49
51
  def test_new_instance(self):
50
52
  self.create_new_row(self.url, self.model, self.payload)
51
53
 
54
+ def test_empty_instance(self):
55
+ """
56
+ testing what happend when empty dictionary get saved
57
+ """
58
+ self.create_new_row(self.url, self.model, self.payload2)
59
+
60
+ active_rows = self.model.query.filter(self.model.deleted_at == None).all()
61
+ has_empty_dict = any(getattr(row, "data", None) == {} for row in active_rows)
62
+ self.assertTrue(has_empty_dict, "Error: Not an empty dicctionary")
63
+
52
64
  def test_new_instance_missing_info(self):
53
65
  del self.payload["data"]["parameters"]
54
66
  self.create_new_row(
@@ -67,7 +79,7 @@ class TestInstancesListEndpoint(BaseTestCases.ListFilters):
67
79
  follow_redirects=True,
68
80
  headers={
69
81
  "Content-Type": "application/json",
70
- "Authorization": "Bearer " + self.token,
82
+ "Authorization": f"Bearer {self.token}",
71
83
  },
72
84
  )
73
85
  self.assertEqual(400, response.status_code)
@@ -203,7 +215,7 @@ class TestInstancesDataEndpoint(TestInstancesDetailEndpointBase):
203
215
  idx = self.create_new_row(self.url, self.model, self.payload)
204
216
  headers = {
205
217
  "Content-Type": "application/json",
206
- "Authorization": "Bearer " + self.token,
218
+ "Authorization": f"Bearer {self.token}",
207
219
  "Accept-Encoding": "gzip",
208
220
  }
209
221
  response = self.client.get(INSTANCE_URL + idx + "/data/", headers=headers)
@@ -28,7 +28,7 @@ class TestInstances(CustomTestCase):
28
28
  follow_redirects=True,
29
29
  headers={
30
30
  "Content-Type": "multipart/form-data",
31
- "Authorization": "Bearer " + self.token,
31
+ "Authorization": f"Bearer {self.token}",
32
32
  },
33
33
  )
34
34
 
@@ -33,7 +33,7 @@ class TestLicensesListEndpoint(CustomTestCase):
33
33
  follow_redirects=True,
34
34
  headers={
35
35
  "Content-Type": "application/json",
36
- "Authorization": "Bearer " + self.token,
36
+ "Authorization": f"Bearer {self.token}",
37
37
  },
38
38
  )
39
39