canvas 0.33.0__py3-none-any.whl → 0.33.1__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.
Potentially problematic release.
This version of canvas might be problematic. Click here for more details.
- {canvas-0.33.0.dist-info → canvas-0.33.1.dist-info}/METADATA +2 -1
- canvas-0.33.1.dist-info/RECORD +272 -0
- canvas_sdk/__init__.py +3 -0
- canvas_sdk/commands/__init__.py +1 -1
- canvas_sdk/commands/base.py +3 -0
- canvas_sdk/commands/commands/__init__.py +1 -0
- canvas_sdk/commands/commands/adjust_prescription.py +3 -0
- canvas_sdk/commands/commands/allergy.py +7 -0
- canvas_sdk/commands/commands/assess.py +2 -0
- canvas_sdk/commands/commands/close_goal.py +3 -0
- canvas_sdk/commands/commands/diagnose.py +3 -0
- canvas_sdk/commands/commands/exam.py +3 -0
- canvas_sdk/commands/commands/family_history.py +3 -0
- canvas_sdk/commands/commands/follow_up.py +3 -0
- canvas_sdk/commands/commands/goal.py +3 -0
- canvas_sdk/commands/commands/history_present_illness.py +3 -0
- canvas_sdk/commands/commands/imaging_order.py +3 -0
- canvas_sdk/commands/commands/instruct.py +3 -0
- canvas_sdk/commands/commands/lab_order.py +3 -0
- canvas_sdk/commands/commands/medical_history.py +3 -0
- canvas_sdk/commands/commands/medication_statement.py +2 -0
- canvas_sdk/commands/commands/past_surgical_history.py +3 -0
- canvas_sdk/commands/commands/perform.py +3 -0
- canvas_sdk/commands/commands/plan.py +3 -0
- canvas_sdk/commands/commands/prescribe.py +8 -0
- canvas_sdk/commands/commands/questionnaire/__init__.py +3 -13
- canvas_sdk/commands/commands/questionnaire/question.py +10 -0
- canvas_sdk/commands/commands/reason_for_visit.py +3 -0
- canvas_sdk/commands/commands/refer.py +3 -0
- canvas_sdk/commands/commands/refill.py +3 -0
- canvas_sdk/commands/commands/remove_allergy.py +3 -0
- canvas_sdk/commands/commands/resolve_condition.py +3 -0
- canvas_sdk/commands/commands/review_of_systems.py +3 -0
- canvas_sdk/commands/commands/stop_medication.py +3 -0
- canvas_sdk/commands/commands/structured_assessment.py +3 -0
- canvas_sdk/commands/commands/task.py +7 -0
- canvas_sdk/commands/commands/update_diagnosis.py +3 -0
- canvas_sdk/commands/commands/update_goal.py +3 -0
- canvas_sdk/commands/commands/vitals.py +3 -0
- canvas_sdk/commands/constants.py +8 -0
- canvas_sdk/effects/__init__.py +1 -1
- canvas_sdk/effects/banner_alert/__init__.py +1 -1
- canvas_sdk/effects/banner_alert/add_banner_alert.py +3 -0
- canvas_sdk/effects/banner_alert/remove_banner_alert.py +3 -0
- canvas_sdk/effects/base.py +7 -0
- canvas_sdk/effects/billing_line_item/__init__.py +5 -1
- canvas_sdk/effects/billing_line_item/add_billing_line_item.py +3 -0
- canvas_sdk/effects/billing_line_item/remove_billing_line_item.py +3 -0
- canvas_sdk/effects/billing_line_item/update_billing_line_item.py +3 -0
- canvas_sdk/effects/launch_modal.py +3 -0
- canvas_sdk/effects/patient_chart_summary_configuration.py +3 -0
- canvas_sdk/effects/patient_portal/__init__.py +1 -0
- canvas_sdk/effects/patient_portal/application_configuration.py +3 -0
- canvas_sdk/effects/patient_portal/form_result.py +3 -0
- canvas_sdk/effects/patient_portal_menu_configuration.py +3 -0
- canvas_sdk/effects/patient_profile_configuration.py +5 -1
- canvas_sdk/effects/protocol_card/__init__.py +1 -1
- canvas_sdk/effects/protocol_card/protocol_card.py +6 -0
- canvas_sdk/effects/questionnaire_result.py +3 -0
- canvas_sdk/effects/send_invite.py +3 -0
- canvas_sdk/effects/show_button.py +3 -0
- canvas_sdk/effects/simple_api.py +9 -0
- canvas_sdk/effects/surescripts/__init__.py +2 -2
- canvas_sdk/effects/surescripts/surescripts_messages.py +7 -0
- canvas_sdk/effects/task/__init__.py +6 -1
- canvas_sdk/effects/task/task.py +8 -0
- canvas_sdk/effects/update_user.py +3 -0
- canvas_sdk/effects/widgets/__init__.py +1 -1
- canvas_sdk/effects/widgets/portal_widget.py +3 -0
- canvas_sdk/events/__init__.py +6 -1
- canvas_sdk/events/base.py +3 -0
- canvas_sdk/handlers/__init__.py +1 -1
- canvas_sdk/handlers/action_button.py +6 -0
- canvas_sdk/handlers/application.py +3 -0
- canvas_sdk/handlers/base.py +3 -0
- canvas_sdk/handlers/cron_task.py +3 -0
- canvas_sdk/handlers/simple_api/__init__.py +3 -2
- canvas_sdk/handlers/simple_api/api.py +26 -1
- canvas_sdk/handlers/simple_api/exceptions.py +10 -0
- canvas_sdk/handlers/simple_api/security.py +21 -5
- canvas_sdk/handlers/simple_api/tools.py +9 -0
- canvas_sdk/protocols/__init__.py +1 -1
- canvas_sdk/protocols/base.py +3 -0
- canvas_sdk/protocols/clinical_quality_measure.py +6 -1
- canvas_sdk/protocols/timeframe.py +3 -0
- canvas_sdk/questionnaires/__init__.py +1 -1
- canvas_sdk/questionnaires/utils.py +7 -0
- canvas_sdk/templates/__init__.py +1 -1
- canvas_sdk/templates/utils.py +3 -0
- canvas_sdk/utils/__init__.py +1 -1
- canvas_sdk/utils/http.py +69 -35
- canvas_sdk/utils/plugins.py +4 -0
- canvas_sdk/utils/stats.py +11 -0
- canvas_sdk/v1/__init__.py +1 -0
- canvas_sdk/v1/apps.py +3 -0
- canvas_sdk/v1/data/__init__.py +2 -2
- canvas_sdk/v1/data/allergy_intolerance.py +3 -0
- canvas_sdk/v1/data/appointment.py +7 -0
- canvas_sdk/v1/data/assessment.py +3 -0
- canvas_sdk/v1/data/banner_alert.py +3 -0
- canvas_sdk/v1/data/base.py +3 -0
- canvas_sdk/v1/data/billing.py +7 -0
- canvas_sdk/v1/data/care_team.py +7 -0
- canvas_sdk/v1/data/command.py +3 -0
- canvas_sdk/v1/data/common.py +18 -0
- canvas_sdk/v1/data/condition.py +7 -0
- canvas_sdk/v1/data/coverage.py +14 -0
- canvas_sdk/v1/data/detected_issue.py +3 -0
- canvas_sdk/v1/data/device.py +3 -0
- canvas_sdk/v1/data/imaging.py +7 -0
- canvas_sdk/v1/data/lab.py +16 -0
- canvas_sdk/v1/data/medication.py +3 -0
- canvas_sdk/v1/data/note.py +9 -0
- canvas_sdk/v1/data/observation.py +9 -0
- canvas_sdk/v1/data/organization.py +3 -0
- canvas_sdk/v1/data/patient.py +18 -2
- canvas_sdk/v1/data/practicelocation.py +7 -0
- canvas_sdk/v1/data/protocol_override.py +7 -0
- canvas_sdk/v1/data/questionnaire.py +16 -3
- canvas_sdk/v1/data/reason_for_visit.py +3 -0
- canvas_sdk/v1/data/staff.py +3 -0
- canvas_sdk/v1/data/task.py +12 -0
- canvas_sdk/v1/data/team.py +8 -1
- canvas_sdk/v1/data/user.py +3 -0
- canvas_sdk/v1/models.py +2 -0
- canvas_sdk/value_set/__init__.py +1 -0
- canvas_sdk/value_set/_utilities.py +16 -0
- canvas_sdk/value_set/custom.py +4 -0
- canvas_sdk/value_set/hcc2018.py +3 -0
- canvas_sdk/value_set/v2022/__init__.py +1 -0
- canvas_sdk/value_set/v2022/adverse_event.py +3 -0
- canvas_sdk/value_set/v2022/allergy.py +5 -0
- canvas_sdk/value_set/v2022/assessment.py +5 -0
- canvas_sdk/value_set/v2022/communication.py +5 -0
- canvas_sdk/value_set/v2022/condition.py +5 -0
- canvas_sdk/value_set/v2022/device.py +5 -0
- canvas_sdk/value_set/v2022/diagnostic_study.py +5 -0
- canvas_sdk/value_set/v2022/encounter.py +5 -0
- canvas_sdk/value_set/v2022/immunization.py +5 -0
- canvas_sdk/value_set/v2022/individual_characteristic.py +5 -0
- canvas_sdk/value_set/v2022/intervention.py +5 -0
- canvas_sdk/value_set/v2022/laboratory_test.py +5 -0
- canvas_sdk/value_set/v2022/medication.py +5 -0
- canvas_sdk/value_set/v2022/physical_exam.py +5 -0
- canvas_sdk/value_set/v2022/procedure.py +5 -0
- canvas_sdk/value_set/v2022/symptom.py +3 -0
- canvas_sdk/value_set/value_set.py +9 -0
- canvas_sdk/views/__init__.py +1 -0
- logger/__init__.py +2 -0
- logger/logger.py +3 -0
- plugin_runner/aws_headers.py +1 -1
- plugin_runner/load_all_plugins.py +202 -0
- plugin_runner/plugin_runner.py +21 -24
- plugin_runner/sandbox.py +497 -115
- settings.py +5 -2
- canvas-0.33.0.dist-info/RECORD +0 -366
- canvas_cli/apps/auth/tests.py +0 -155
- canvas_cli/apps/plugin/tests.py +0 -85
- canvas_cli/conftest.py +0 -28
- canvas_cli/tests.py +0 -217
- canvas_cli/utils/context/tests.py +0 -131
- canvas_cli/utils/print/tests.py +0 -69
- canvas_cli/utils/urls/tests.py +0 -12
- canvas_cli/utils/validators/tests.py +0 -37
- canvas_sdk/commands/tests/protocol/__init__.py +0 -0
- canvas_sdk/commands/tests/protocol/tests.py +0 -83
- canvas_sdk/commands/tests/schema/__init__.py +0 -0
- canvas_sdk/commands/tests/schema/tests.py +0 -108
- canvas_sdk/commands/tests/test_base_command.py +0 -81
- canvas_sdk/commands/tests/test_utils.py +0 -375
- canvas_sdk/commands/tests/unit/__init__.py +0 -0
- canvas_sdk/commands/tests/unit/tests.py +0 -278
- canvas_sdk/effects/banner_alert/tests.py +0 -288
- canvas_sdk/effects/protocol_card/tests.py +0 -191
- canvas_sdk/questionnaires/tests/__init__.py +0 -0
- canvas_sdk/questionnaires/tests/test_utils.py +0 -74
- canvas_sdk/templates/tests/__init__.py +0 -0
- canvas_sdk/templates/tests/test_utils.py +0 -43
- canvas_sdk/tests/__init__.py +0 -0
- canvas_sdk/tests/handlers/__init__.py +0 -0
- canvas_sdk/tests/handlers/test_simple_api.py +0 -1167
- canvas_sdk/utils/tests.py +0 -72
- canvas_sdk/value_set/tests/test_value_sets.py +0 -72
- plugin_runner/tests/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/example_plugin/CANVAS_MANIFEST.json +0 -29
- plugin_runner/tests/fixtures/plugins/example_plugin/README.md +0 -12
- plugin_runner/tests/fixtures/plugins/example_plugin/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/example_plugin/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/example_plugin/protocols/my_protocol.py +0 -18
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/CANVAS_MANIFEST.json +0 -38
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/README.md +0 -11
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/protocols/my_protocol.py +0 -33
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/templates/__init__.py +0 -3
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/templates/base.py +0 -6
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/utils/__init__.py +0 -5
- plugin_runner/tests/fixtures/plugins/test_implicit_imports_plugin/utils/base.py +0 -4
- plugin_runner/tests/fixtures/plugins/test_load_questionnaire/CANVAS_MANIFEST.json +0 -52
- plugin_runner/tests/fixtures/plugins/test_load_questionnaire/README.md +0 -11
- plugin_runner/tests/fixtures/plugins/test_load_questionnaire/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_load_questionnaire/protocols/my_protocol.py +0 -39
- plugin_runner/tests/fixtures/plugins/test_load_questionnaire/questionnaires/example_questionnaire.yml +0 -61
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_plugin/CANVAS_MANIFEST.json +0 -29
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_plugin/README.md +0 -12
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_plugin/other_module/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_plugin/other_module/base.py +0 -10
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_plugin/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_plugin/protocols/my_protocol.py +0 -18
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_runtime_plugin/CANVAS_MANIFEST.json +0 -29
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_runtime_plugin/README.md +0 -12
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_runtime_plugin/other_module/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_runtime_plugin/other_module/base.py +0 -10
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_runtime_plugin/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_forbidden_imports_runtime_plugin/protocols/my_protocol.py +0 -18
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/CANVAS_MANIFEST.json +0 -29
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/README.md +0 -12
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/other_module/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/other_module/base.py +0 -3
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/protocols/my_protocol.py +0 -18
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/CANVAS_MANIFEST.json +0 -29
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/README.md +0 -12
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/other_module/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/other_module/base.py +0 -6
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/protocols/my_protocol.py +0 -18
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/CANVAS_MANIFEST.json +0 -29
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/README.md +0 -12
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/other_module/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/other_module/base.py +0 -8
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/protocols/my_protocol.py +0 -18
- plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/CANVAS_MANIFEST.json +0 -29
- plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/README.md +0 -12
- plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/other_module/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/other_module/base.py +0 -3
- plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_module_imports_plugin/protocols/my_protocol.py +0 -18
- plugin_runner/tests/fixtures/plugins/test_render_template/CANVAS_MANIFEST.json +0 -47
- plugin_runner/tests/fixtures/plugins/test_render_template/README.md +0 -11
- plugin_runner/tests/fixtures/plugins/test_render_template/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_render_template/protocols/my_protocol.py +0 -43
- plugin_runner/tests/fixtures/plugins/test_render_template/templates/template.html +0 -10
- plugin_runner/tests/fixtures/plugins/test_simple_api/CANVAS_MANIFEST.json +0 -47
- plugin_runner/tests/fixtures/plugins/test_simple_api/README.md +0 -11
- plugin_runner/tests/fixtures/plugins/test_simple_api/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_simple_api/protocols/__init__.py +0 -0
- plugin_runner/tests/fixtures/plugins/test_simple_api/protocols/my_protocol.py +0 -43
- plugin_runner/tests/test_application.py +0 -65
- plugin_runner/tests/test_plugin_installer.py +0 -127
- plugin_runner/tests/test_plugin_runner.py +0 -388
- plugin_runner/tests/test_sandbox.py +0 -137
- {canvas-0.33.0.dist-info → canvas-0.33.1.dist-info}/WHEEL +0 -0
- {canvas-0.33.0.dist-info → canvas-0.33.1.dist-info}/entry_points.txt +0 -0
plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/CANVAS_MANIFEST.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"sdk_version": "0.1.4",
|
|
3
|
-
"plugin_version": "0.0.1",
|
|
4
|
-
"name": "test_module_imports_outside_plugin_v1",
|
|
5
|
-
"description": "Edit the description in CANVAS_MANIFEST.json",
|
|
6
|
-
"components": {
|
|
7
|
-
"protocols": [
|
|
8
|
-
{
|
|
9
|
-
"class": "test_module_imports_outside_plugin_v1.protocols.my_protocol:Protocol",
|
|
10
|
-
"description": "A protocol that does xyz...",
|
|
11
|
-
"data_access": {
|
|
12
|
-
"event": "",
|
|
13
|
-
"read": [],
|
|
14
|
-
"write": []
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"commands": [],
|
|
19
|
-
"content": [],
|
|
20
|
-
"effects": [],
|
|
21
|
-
"views": []
|
|
22
|
-
},
|
|
23
|
-
"secrets": [],
|
|
24
|
-
"tags": {},
|
|
25
|
-
"references": [],
|
|
26
|
-
"license": "",
|
|
27
|
-
"diagram": false,
|
|
28
|
-
"readme": "./README.md"
|
|
29
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
==========================
|
|
2
|
-
test_module_imports_outside_plugin_v1
|
|
3
|
-
==========================
|
|
4
|
-
|
|
5
|
-
## Description
|
|
6
|
-
|
|
7
|
-
A description of this plugin
|
|
8
|
-
|
|
9
|
-
### Important Note!
|
|
10
|
-
|
|
11
|
-
The CANVAS_MANIFEST.json is used when installing your plugin. Please ensure it
|
|
12
|
-
gets updated if you add, remove, or rename protocols.
|
plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/other_module/__init__.py
DELETED
|
File without changes
|
plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/protocols/__init__.py
DELETED
|
File without changes
|
plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v1/protocols/my_protocol.py
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
from test_module_imports_plugin.other_module.base import import_me
|
|
2
|
-
|
|
3
|
-
from canvas_sdk.effects import Effect, EffectType
|
|
4
|
-
from canvas_sdk.events import EventType
|
|
5
|
-
from canvas_sdk.protocols import BaseProtocol
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Protocol(BaseProtocol):
|
|
9
|
-
"""
|
|
10
|
-
You should put a helpful description of this protocol's behavior here.
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
# Name the event type you wish to run in response to
|
|
14
|
-
RESPONDS_TO = EventType.Name(EventType.UNKNOWN)
|
|
15
|
-
|
|
16
|
-
def compute(self) -> list[Effect]:
|
|
17
|
-
"""This method gets called when an event of the type RESPONDS_TO is fired."""
|
|
18
|
-
return [Effect(type=EffectType.LOG, payload=import_me())]
|
plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/CANVAS_MANIFEST.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"sdk_version": "0.1.4",
|
|
3
|
-
"plugin_version": "0.0.1",
|
|
4
|
-
"name": "test_module_imports_outside_plugin_v2",
|
|
5
|
-
"description": "Edit the description in CANVAS_MANIFEST.json",
|
|
6
|
-
"components": {
|
|
7
|
-
"protocols": [
|
|
8
|
-
{
|
|
9
|
-
"class": "test_module_imports_outside_plugin_v2.protocols.my_protocol:Protocol",
|
|
10
|
-
"description": "A protocol that does xyz...",
|
|
11
|
-
"data_access": {
|
|
12
|
-
"event": "",
|
|
13
|
-
"read": [],
|
|
14
|
-
"write": []
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"commands": [],
|
|
19
|
-
"content": [],
|
|
20
|
-
"effects": [],
|
|
21
|
-
"views": []
|
|
22
|
-
},
|
|
23
|
-
"secrets": [],
|
|
24
|
-
"tags": {},
|
|
25
|
-
"references": [],
|
|
26
|
-
"license": "",
|
|
27
|
-
"diagram": false,
|
|
28
|
-
"readme": "./README.md"
|
|
29
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
==========================
|
|
2
|
-
test_module_imports_outside_plugin_v2
|
|
3
|
-
==========================
|
|
4
|
-
|
|
5
|
-
## Description
|
|
6
|
-
|
|
7
|
-
A description of this plugin
|
|
8
|
-
|
|
9
|
-
### Important Note!
|
|
10
|
-
|
|
11
|
-
The CANVAS_MANIFEST.json is used when installing your plugin. Please ensure it
|
|
12
|
-
gets updated if you add, remove, or rename protocols.
|
plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/other_module/__init__.py
DELETED
|
File without changes
|
plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/protocols/__init__.py
DELETED
|
File without changes
|
plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v2/protocols/my_protocol.py
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
from test_module_imports_outside_plugin_v2.other_module.base import import_me
|
|
2
|
-
|
|
3
|
-
from canvas_sdk.effects import Effect, EffectType
|
|
4
|
-
from canvas_sdk.events import EventType
|
|
5
|
-
from canvas_sdk.protocols import BaseProtocol
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Protocol(BaseProtocol):
|
|
9
|
-
"""
|
|
10
|
-
You should put a helpful description of this protocol's behavior here.
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
# Name the event type you wish to run in response to
|
|
14
|
-
RESPONDS_TO = EventType.Name(EventType.UNKNOWN)
|
|
15
|
-
|
|
16
|
-
def compute(self) -> list[Effect]:
|
|
17
|
-
"""This method gets called when an event of the type RESPONDS_TO is fired."""
|
|
18
|
-
return [Effect(type=EffectType.LOG, payload=import_me())]
|
plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/CANVAS_MANIFEST.json
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"sdk_version": "0.1.4",
|
|
3
|
-
"plugin_version": "0.0.1",
|
|
4
|
-
"name": "test_module_imports_outside_plugin_v3",
|
|
5
|
-
"description": "Edit the description in CANVAS_MANIFEST.json",
|
|
6
|
-
"components": {
|
|
7
|
-
"protocols": [
|
|
8
|
-
{
|
|
9
|
-
"class": "test_module_imports_outside_plugin_v3.protocols.my_protocol:Protocol",
|
|
10
|
-
"description": "A protocol that does xyz...",
|
|
11
|
-
"data_access": {
|
|
12
|
-
"event": "",
|
|
13
|
-
"read": [],
|
|
14
|
-
"write": []
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"commands": [],
|
|
19
|
-
"content": [],
|
|
20
|
-
"effects": [],
|
|
21
|
-
"views": []
|
|
22
|
-
},
|
|
23
|
-
"secrets": [],
|
|
24
|
-
"tags": {},
|
|
25
|
-
"references": [],
|
|
26
|
-
"license": "",
|
|
27
|
-
"diagram": false,
|
|
28
|
-
"readme": "./README.md"
|
|
29
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
==========================
|
|
2
|
-
test_module_imports_outside_plugin_v3
|
|
3
|
-
==========================
|
|
4
|
-
|
|
5
|
-
## Description
|
|
6
|
-
|
|
7
|
-
A description of this plugin
|
|
8
|
-
|
|
9
|
-
### Important Note!
|
|
10
|
-
|
|
11
|
-
The CANVAS_MANIFEST.json is used when installing your plugin. Please ensure it
|
|
12
|
-
gets updated if you add, remove, or rename protocols.
|
plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/other_module/__init__.py
DELETED
|
File without changes
|
plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/protocols/__init__.py
DELETED
|
File without changes
|
plugin_runner/tests/fixtures/plugins/test_module_imports_outside_plugin_v3/protocols/my_protocol.py
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
from test_module_imports_outside_plugin_v3.other_module.base import import_me
|
|
2
|
-
|
|
3
|
-
from canvas_sdk.effects import Effect, EffectType
|
|
4
|
-
from canvas_sdk.events import EventType
|
|
5
|
-
from canvas_sdk.protocols import BaseProtocol
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Protocol(BaseProtocol):
|
|
9
|
-
"""
|
|
10
|
-
You should put a helpful description of this protocol's behavior here.
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
# Name the event type you wish to run in response to
|
|
14
|
-
RESPONDS_TO = EventType.Name(EventType.UNKNOWN)
|
|
15
|
-
|
|
16
|
-
def compute(self) -> list[Effect]:
|
|
17
|
-
"""This method gets called when an event of the type RESPONDS_TO is fired."""
|
|
18
|
-
return [Effect(type=EffectType.LOG, payload=import_me())]
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"sdk_version": "0.1.4",
|
|
3
|
-
"plugin_version": "0.0.1",
|
|
4
|
-
"name": "test_module_imports_plugin",
|
|
5
|
-
"description": "Edit the description in CANVAS_MANIFEST.json",
|
|
6
|
-
"components": {
|
|
7
|
-
"protocols": [
|
|
8
|
-
{
|
|
9
|
-
"class": "test_module_imports_plugin.protocols.my_protocol:Protocol",
|
|
10
|
-
"description": "A protocol that does xyz...",
|
|
11
|
-
"data_access": {
|
|
12
|
-
"event": "",
|
|
13
|
-
"read": [],
|
|
14
|
-
"write": []
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
],
|
|
18
|
-
"commands": [],
|
|
19
|
-
"content": [],
|
|
20
|
-
"effects": [],
|
|
21
|
-
"views": []
|
|
22
|
-
},
|
|
23
|
-
"secrets": [],
|
|
24
|
-
"tags": {},
|
|
25
|
-
"references": [],
|
|
26
|
-
"license": "",
|
|
27
|
-
"diagram": false,
|
|
28
|
-
"readme": "./README.md"
|
|
29
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
==========================
|
|
2
|
-
test_module_imports_plugin
|
|
3
|
-
==========================
|
|
4
|
-
|
|
5
|
-
## Description
|
|
6
|
-
|
|
7
|
-
A description of this plugin
|
|
8
|
-
|
|
9
|
-
### Important Note!
|
|
10
|
-
|
|
11
|
-
The CANVAS_MANIFEST.json is used when installing your plugin. Please ensure it
|
|
12
|
-
gets updated if you add, remove, or rename protocols.
|
|
File without changes
|
|
File without changes
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
from test_module_imports_plugin.other_module.base import import_me
|
|
2
|
-
|
|
3
|
-
from canvas_sdk.effects import Effect, EffectType
|
|
4
|
-
from canvas_sdk.events import EventType
|
|
5
|
-
from canvas_sdk.protocols import BaseProtocol
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Protocol(BaseProtocol):
|
|
9
|
-
"""
|
|
10
|
-
You should put a helpful description of this protocol's behavior here.
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
# Name the event type you wish to run in response to
|
|
14
|
-
RESPONDS_TO = EventType.Name(EventType.UNKNOWN)
|
|
15
|
-
|
|
16
|
-
def compute(self) -> list[Effect]:
|
|
17
|
-
"""This method gets called when an event of the type RESPONDS_TO is fired."""
|
|
18
|
-
return [Effect(type=EffectType.LOG, payload=import_me())]
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"sdk_version": "0.1.4",
|
|
3
|
-
"plugin_version": "0.0.1",
|
|
4
|
-
"name": "test_render_template",
|
|
5
|
-
"description": "Edit the description in CANVAS_MANIFEST.json",
|
|
6
|
-
"components": {
|
|
7
|
-
"protocols": [
|
|
8
|
-
{
|
|
9
|
-
"class": "test_render_template.protocols.my_protocol:ValidTemplate",
|
|
10
|
-
"description": "A protocol that does xyz...",
|
|
11
|
-
"data_access": {
|
|
12
|
-
"event": "",
|
|
13
|
-
"read": [],
|
|
14
|
-
"write": []
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"class": "test_render_template.protocols.my_protocol:InvalidTemplate",
|
|
19
|
-
"description": "A protocol that does xyz...",
|
|
20
|
-
"data_access": {
|
|
21
|
-
"event": "",
|
|
22
|
-
"read": [],
|
|
23
|
-
"write": []
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"class": "test_render_template.protocols.my_protocol:ForbiddenTemplate",
|
|
28
|
-
"description": "A protocol that does xyz...",
|
|
29
|
-
"data_access": {
|
|
30
|
-
"event": "",
|
|
31
|
-
"read": [],
|
|
32
|
-
"write": []
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
],
|
|
36
|
-
"commands": [],
|
|
37
|
-
"content": [],
|
|
38
|
-
"effects": [],
|
|
39
|
-
"views": []
|
|
40
|
-
},
|
|
41
|
-
"secrets": [],
|
|
42
|
-
"tags": {},
|
|
43
|
-
"references": [],
|
|
44
|
-
"license": "",
|
|
45
|
-
"diagram": false,
|
|
46
|
-
"readme": "./README.md"
|
|
47
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
test_render_template
|
|
2
|
-
====================
|
|
3
|
-
|
|
4
|
-
## Description
|
|
5
|
-
|
|
6
|
-
A description of this plugin
|
|
7
|
-
|
|
8
|
-
### Important Note!
|
|
9
|
-
|
|
10
|
-
The CANVAS_MANIFEST.json is used when installing your plugin. Please ensure it
|
|
11
|
-
gets updated if you add, remove, or rename protocols.
|
|
File without changes
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
from canvas_sdk.effects import Effect, EffectType
|
|
2
|
-
from canvas_sdk.events import EventType
|
|
3
|
-
from canvas_sdk.protocols import BaseProtocol
|
|
4
|
-
from canvas_sdk.templates import render_to_string
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class ValidTemplate(BaseProtocol):
|
|
8
|
-
"""You should put a helpful description of this protocol's behavior here."""
|
|
9
|
-
|
|
10
|
-
RESPONDS_TO = [EventType.Name(EventType.UNKNOWN)]
|
|
11
|
-
|
|
12
|
-
def compute(self) -> list[Effect]:
|
|
13
|
-
"""This method gets called when an event of the type RESPONDS_TO is fired."""
|
|
14
|
-
return [
|
|
15
|
-
Effect(type=EffectType.LOG, payload=render_to_string("templates/template.html", None))
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class InvalidTemplate(BaseProtocol):
|
|
20
|
-
"""You should put a helpful description of this protocol's behavior here."""
|
|
21
|
-
|
|
22
|
-
RESPONDS_TO = [EventType.Name(EventType.UNKNOWN)]
|
|
23
|
-
|
|
24
|
-
def compute(self) -> list[Effect]:
|
|
25
|
-
"""This method gets called when an event of the type RESPONDS_TO is fired."""
|
|
26
|
-
return [
|
|
27
|
-
Effect(type=EffectType.LOG, payload=render_to_string("templates/template1.html", None))
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class ForbiddenTemplate(BaseProtocol):
|
|
32
|
-
"""You should put a helpful description of this protocol's behavior here."""
|
|
33
|
-
|
|
34
|
-
RESPONDS_TO = [EventType.Name(EventType.UNKNOWN)]
|
|
35
|
-
|
|
36
|
-
def compute(self) -> list[Effect]:
|
|
37
|
-
"""This method gets called when an event of the type RESPONDS_TO is fired."""
|
|
38
|
-
return [
|
|
39
|
-
Effect(
|
|
40
|
-
type=EffectType.LOG,
|
|
41
|
-
payload=render_to_string("../../templates/template.html", None),
|
|
42
|
-
)
|
|
43
|
-
]
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"sdk_version": "0.1.4",
|
|
3
|
-
"plugin_version": "0.0.1",
|
|
4
|
-
"name": "test_simple_api",
|
|
5
|
-
"description": "Edit the description in CANVAS_MANIFEST.json",
|
|
6
|
-
"components": {
|
|
7
|
-
"protocols": [
|
|
8
|
-
{
|
|
9
|
-
"class": "test_simple_api.protocols.my_protocol:Route",
|
|
10
|
-
"description": "A protocol that does xyz...",
|
|
11
|
-
"data_access": {
|
|
12
|
-
"event": "",
|
|
13
|
-
"read": [],
|
|
14
|
-
"write": []
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"class": "test_simple_api.protocols.my_protocol:ErrorRoute1",
|
|
19
|
-
"description": "A protocol that does xyz...",
|
|
20
|
-
"data_access": {
|
|
21
|
-
"event": "",
|
|
22
|
-
"read": [],
|
|
23
|
-
"write": []
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"class": "test_simple_api.protocols.my_protocol:ErrorRoute2",
|
|
28
|
-
"description": "A protocol that does xyz...",
|
|
29
|
-
"data_access": {
|
|
30
|
-
"event": "",
|
|
31
|
-
"read": [],
|
|
32
|
-
"write": []
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
],
|
|
36
|
-
"commands": [],
|
|
37
|
-
"content": [],
|
|
38
|
-
"effects": [],
|
|
39
|
-
"views": []
|
|
40
|
-
},
|
|
41
|
-
"secrets": [],
|
|
42
|
-
"tags": {},
|
|
43
|
-
"references": [],
|
|
44
|
-
"license": "",
|
|
45
|
-
"diagram": false,
|
|
46
|
-
"readme": "./README.md"
|
|
47
|
-
}
|
|
File without changes
|
|
File without changes
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
from http import HTTPStatus
|
|
2
|
-
|
|
3
|
-
from canvas_sdk.effects import Effect
|
|
4
|
-
from canvas_sdk.effects.simple_api import Response
|
|
5
|
-
from canvas_sdk.handlers.simple_api import Credentials, SimpleAPIRoute
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class NoAuth(SimpleAPIRoute):
|
|
9
|
-
"""SimpleAPIRoute base class to bypass authentication."""
|
|
10
|
-
|
|
11
|
-
def authenticate(self, credentials: Credentials) -> bool:
|
|
12
|
-
"""Authenticate the request."""
|
|
13
|
-
return True
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class Route(NoAuth):
|
|
17
|
-
"""Handler for /route."""
|
|
18
|
-
|
|
19
|
-
PATH = "/route"
|
|
20
|
-
|
|
21
|
-
def get(self) -> list[Response | Effect]:
|
|
22
|
-
"""Handler method for GET."""
|
|
23
|
-
return [Response(status_code=HTTPStatus.OK)]
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class ErrorRoute1(NoAuth):
|
|
27
|
-
"""Handler #1 for /error."""
|
|
28
|
-
|
|
29
|
-
PATH = "/error"
|
|
30
|
-
|
|
31
|
-
def get(self) -> list[Response | Effect]:
|
|
32
|
-
"""Handler method for GET."""
|
|
33
|
-
return [Response(status_code=HTTPStatus.OK)]
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
class ErrorRoute2(NoAuth):
|
|
37
|
-
"""Handler #2 for /error."""
|
|
38
|
-
|
|
39
|
-
PATH = "/error"
|
|
40
|
-
|
|
41
|
-
def get(self) -> list[Response | Effect]:
|
|
42
|
-
"""Handler method for GET."""
|
|
43
|
-
return [Response(status_code=HTTPStatus.OK)]
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import pytest
|
|
2
|
-
|
|
3
|
-
from canvas_sdk.effects import Effect
|
|
4
|
-
from canvas_sdk.effects.launch_modal import LaunchModalEffect
|
|
5
|
-
from canvas_sdk.events import Event, EventRequest, EventType
|
|
6
|
-
from canvas_sdk.handlers.application import Application
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class ExampleApplication(Application):
|
|
10
|
-
"""A concrete implementation of the Application class for testing."""
|
|
11
|
-
|
|
12
|
-
def on_open(self) -> Effect:
|
|
13
|
-
"""Handle the application open event by returning a mock effect."""
|
|
14
|
-
return LaunchModalEffect(url="https://example.com").apply()
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@pytest.fixture
|
|
18
|
-
def app_instance(event: Event) -> ExampleApplication:
|
|
19
|
-
"""Provide an instance of the TestApplication with a mocked event."""
|
|
20
|
-
app = ExampleApplication(event)
|
|
21
|
-
return app
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def test_compute_event_not_targeted() -> None:
|
|
25
|
-
"""Test that compute filters out events not targeted for the app."""
|
|
26
|
-
request = EventRequest(type=EventType.APPLICATION__ON_OPEN, target="some_identifier")
|
|
27
|
-
event = Event(request)
|
|
28
|
-
app = ExampleApplication(event)
|
|
29
|
-
|
|
30
|
-
result = app.compute()
|
|
31
|
-
|
|
32
|
-
assert result == [], "Expected no effects if the event target is not the app identifier"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def test_compute_event_targeted() -> None:
|
|
36
|
-
"""Test that compute processes events targeted for the app."""
|
|
37
|
-
request = EventRequest(
|
|
38
|
-
type=EventType.APPLICATION__ON_OPEN,
|
|
39
|
-
target=f"{ExampleApplication.__module__}:{ExampleApplication.__qualname__}",
|
|
40
|
-
)
|
|
41
|
-
event = Event(request)
|
|
42
|
-
app = ExampleApplication(event)
|
|
43
|
-
result = app.compute()
|
|
44
|
-
|
|
45
|
-
assert len(result) == 1, "Expected a single effect if the event target is the app identifier"
|
|
46
|
-
assert isinstance(result[0], Effect), "Effect should be an instance of Effect"
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def test_identifier_property() -> None:
|
|
50
|
-
"""Test the identifier property of the Application class."""
|
|
51
|
-
expected_identifier = f"{ExampleApplication.__module__}:{ExampleApplication.__qualname__}"
|
|
52
|
-
request = EventRequest(
|
|
53
|
-
type=EventType.APPLICATION__ON_OPEN,
|
|
54
|
-
target=f"{ExampleApplication.__module__}:{ExampleApplication.__qualname__}",
|
|
55
|
-
)
|
|
56
|
-
event = Event(request)
|
|
57
|
-
app = ExampleApplication(event)
|
|
58
|
-
|
|
59
|
-
assert app.identifier == expected_identifier, "The identifier property is incorrect"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def test_abstract_method_on_open() -> None:
|
|
63
|
-
"""Test that the abstract method on_open must be implemented."""
|
|
64
|
-
with pytest.raises(TypeError):
|
|
65
|
-
Application(Event(EventRequest(type=EventType.UNKNOWN))) # type: ignore[abstract]
|