jaseci 1.4.0.9__py3-none-any.whl → 1.4.0.11__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 jaseci might be problematic. Click here for more details.
- jaseci/VERSION +1 -1
- jaseci/__init__.py +3 -0
- jaseci/actions/standard/elastic.py +3 -2
- jaseci/actions/standard/mail.py +3 -2
- jaseci/actions/standard/std.py +3 -2
- jaseci/actions/standard/stripe.py +3 -2
- jaseci/actions/standard/task.py +3 -5
- jaseci/actions/standard/tests/test_mail_lib.py +8 -7
- jaseci/actions/tests/test_std.py +4 -5
- jaseci/actor/walker.py +6 -3
- jaseci/api/config_api.py +3 -2
- jaseci/api/jac_api.py +2 -2
- jaseci/api/jsorc_api.py +60 -121
- jaseci/api/prometheus_api.py +14 -20
- jaseci/api/queue_api.py +9 -5
- jaseci/api/tests/test_global_api.py +3 -3
- jaseci/api/tests/test_logger_api.py +3 -3
- jaseci/api/user_api.py +3 -3
- jaseci/api/webhook_api.py +6 -4
- jaseci/attr/action.py +10 -4
- jaseci/element/master.py +2 -0
- jaseci/element/super_master.py +2 -0
- jaseci/hook/memory.py +3 -1
- jaseci/hook/redis.py +5 -4
- jaseci/jac/interpreter/interp.py +16 -4
- jaseci/jac/tests/test_book.py +2 -2
- jaseci/jsctl/jsctl.py +48 -15
- jaseci/jsctl/tests/test_jsctl.py +5 -0
- jaseci/jsorc.py +733 -0
- jaseci/jsorc_settings.py +184 -0
- jaseci/manifests/database.yaml +107 -0
- jaseci/manifests/elastic.yaml +5923 -0
- jaseci/manifests/prometheus.yaml +1273 -0
- jaseci/{svc/jsorc-backup/jaseci-redis.yaml → manifests/redis.yaml} +20 -0
- jaseci/svc/__init__.py +0 -25
- jaseci/svc/{elastic/elastic.py → elastic_svc.py} +5 -16
- jaseci/svc/kube_svc.py +240 -0
- jaseci/svc/{mail/mail.py → mail_svc.py} +14 -17
- jaseci/svc/{prometheus/prometheus.py → prome_svc.py} +5 -16
- jaseci/svc/{redis/redis.py → redis_svc.py} +14 -26
- jaseci/svc/{stripe/stripe.py → stripe_svc.py} +4 -7
- jaseci/svc/{task/task.py → task_svc.py} +27 -24
- jaseci/svc/{task/common.py → tasks.py} +287 -293
- jaseci/tests/jac_test_progs.py +21 -0
- jaseci/tests/test_core.py +14 -15
- jaseci/tests/test_jac.py +59 -60
- jaseci/tests/test_node.py +6 -13
- jaseci/tests/test_progs.py +74 -52
- jaseci/tests/test_stripe.py +6 -10
- jaseci/utils/actions/actions_manager.py +254 -0
- jaseci/{svc/actions_optimizer → utils/actions}/actions_optimizer.py +9 -19
- jaseci/utils/json_handler.py +2 -3
- jaseci/utils/test_core.py +4 -5
- jaseci/utils/utils.py +12 -0
- {jaseci-1.4.0.9.dist-info → jaseci-1.4.0.11.dist-info}/METADATA +2 -1
- {jaseci-1.4.0.9.dist-info → jaseci-1.4.0.11.dist-info}/RECORD +63 -80
- jaseci/svc/common.py +0 -763
- jaseci/svc/config.py +0 -9
- jaseci/svc/elastic/__init__.py +0 -3
- jaseci/svc/elastic/config.py +0 -8
- jaseci/svc/elastic/manifest.py +0 -1
- jaseci/svc/jsorc-backup/jsorc.py +0 -182
- jaseci/svc/jsorc-backup/promon/__init__.py +0 -0
- jaseci/svc/jsorc-backup/promon/promon.py +0 -202
- jaseci/svc/mail/__init__.py +0 -4
- jaseci/svc/mail/config.py +0 -25
- jaseci/svc/meta.py +0 -164
- jaseci/svc/postgres/__init__.py +0 -0
- jaseci/svc/postgres/manifest.py +0 -106
- jaseci/svc/prometheus/__init__.py +0 -5
- jaseci/svc/prometheus/config.py +0 -11
- jaseci/svc/prometheus/manifest.py +0 -1102
- jaseci/svc/redis/__init__.py +0 -5
- jaseci/svc/redis/config.py +0 -10
- jaseci/svc/redis/manifest.py +0 -65
- jaseci/svc/state.py +0 -17
- jaseci/svc/stripe/__init__.py +0 -3
- jaseci/svc/stripe/config.py +0 -7
- jaseci/svc/task/__init__.py +0 -5
- jaseci/svc/task/config.py +0 -17
- /jaseci/{svc/actions_optimizer → manifests}/__init__.py +0 -0
- /jaseci/{svc/jsorc-backup → utils/actions}/__init__.py +0 -0
- /jaseci/{svc/actions_optimizer → utils/actions}/actions_state.py +0 -0
- {jaseci-1.4.0.9.dist-info → jaseci-1.4.0.11.dist-info}/LICENSE +0 -0
- {jaseci-1.4.0.9.dist-info → jaseci-1.4.0.11.dist-info}/WHEEL +0 -0
- {jaseci-1.4.0.9.dist-info → jaseci-1.4.0.11.dist-info}/entry_points.txt +0 -0
- {jaseci-1.4.0.9.dist-info → jaseci-1.4.0.11.dist-info}/top_level.txt +0 -0
jaseci/tests/test_node.py
CHANGED
|
@@ -4,23 +4,16 @@ from jaseci.actor.architype import Architype
|
|
|
4
4
|
from jaseci.attr import action
|
|
5
5
|
from jaseci.graph.edge import Edge
|
|
6
6
|
from jaseci.graph.node import Node
|
|
7
|
-
from jaseci
|
|
7
|
+
from jaseci import JsOrc
|
|
8
8
|
from jaseci.utils.utils import TestCaseHelper
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
class NodeTests(TestCaseHelper, TestCase):
|
|
12
12
|
"""Tests for the funcationality of Jaseci node class"""
|
|
13
13
|
|
|
14
|
-
def setUp(self):
|
|
15
|
-
super().setUp()
|
|
16
|
-
self.meta = MetaService()
|
|
17
|
-
|
|
18
|
-
def tearDown(self):
|
|
19
|
-
super().tearDown()
|
|
20
|
-
|
|
21
14
|
def test_node_connections(self):
|
|
22
15
|
"""Test connecting and disconnecting etc of nodes"""
|
|
23
|
-
node1 = Node(m_id=0, h=
|
|
16
|
+
node1 = Node(m_id=0, h=JsOrc.hook())
|
|
24
17
|
node2 = Node(m_id=0, h=node1._h)
|
|
25
18
|
node3 = Node(m_id=0, h=node1._h)
|
|
26
19
|
node4 = Node(m_id=0, h=node1._h)
|
|
@@ -49,7 +42,7 @@ class NodeTests(TestCaseHelper, TestCase):
|
|
|
49
42
|
|
|
50
43
|
def test_add_context_to_node_and_destroy(self):
|
|
51
44
|
"""Test adding and removing contexts nodes"""
|
|
52
|
-
node1 = Node(m_id=0, h=
|
|
45
|
+
node1 = Node(m_id=0, h=JsOrc.hook())
|
|
53
46
|
node1.context["yeah dude"] = "SUP"
|
|
54
47
|
self.assertEqual(node1.context["yeah dude"], "SUP")
|
|
55
48
|
self.assertEqual(len(node1.context.keys()), 1)
|
|
@@ -58,7 +51,7 @@ class NodeTests(TestCaseHelper, TestCase):
|
|
|
58
51
|
|
|
59
52
|
def test_add_entry_action_to_node_and_destroy(self):
|
|
60
53
|
"""Test connecting and disconnecting etc of nodes"""
|
|
61
|
-
node1 = Architype(m_id=0, h=
|
|
54
|
+
node1 = Architype(m_id=0, h=JsOrc.hook())
|
|
62
55
|
act = action.Action(m_id=0, h=node1._h, name="yeah dude", value="SUP")
|
|
63
56
|
node1.entry_action_ids.add_obj(act)
|
|
64
57
|
self.assertEqual(
|
|
@@ -74,7 +67,7 @@ class NodeTests(TestCaseHelper, TestCase):
|
|
|
74
67
|
|
|
75
68
|
def test_adding_and_removing_from_hdnodes(self):
|
|
76
69
|
"""Test adding nodes and removing them from HDGDs"""
|
|
77
|
-
node1 = Node(m_id=0, h=
|
|
70
|
+
node1 = Node(m_id=0, h=JsOrc.hook())
|
|
78
71
|
hdgd1 = Node(m_id=0, h=node1._h, name="yeah dude", dimension=1)
|
|
79
72
|
node1.make_member_of(hdgd1)
|
|
80
73
|
self.assertEqual(node1.parent_node_ids.obj_list()[0], hdgd1)
|
|
@@ -89,7 +82,7 @@ class NodeTests(TestCaseHelper, TestCase):
|
|
|
89
82
|
|
|
90
83
|
def test_inherit_from_element_edge(self):
|
|
91
84
|
"""Test that inheriting params with kwargs works"""
|
|
92
|
-
hook =
|
|
85
|
+
hook = JsOrc.hook()
|
|
93
86
|
a = Edge(
|
|
94
87
|
name="my edge",
|
|
95
88
|
m_id=0,
|
jaseci/tests/test_progs.py
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import pytest
|
|
3
3
|
from unittest import TestCase
|
|
4
|
-
from jaseci.svc import ServiceState
|
|
5
4
|
|
|
6
5
|
import jaseci.tests.jac_test_progs as jtp
|
|
7
6
|
from jaseci.actor.sentinel import Sentinel
|
|
8
7
|
from jaseci.graph.graph import Graph
|
|
9
8
|
from jaseci.graph.node import Node
|
|
10
|
-
from jaseci.svc import MetaService
|
|
11
9
|
from jaseci.utils.utils import TestCaseHelper
|
|
10
|
+
from jaseci import JsOrc, State
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
class JacTests(TestCaseHelper, TestCase):
|
|
@@ -17,14 +16,12 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
17
16
|
def setUp(self):
|
|
18
17
|
super().setUp()
|
|
19
18
|
|
|
20
|
-
self.meta = MetaService()
|
|
21
|
-
|
|
22
19
|
def tearDown(self):
|
|
23
20
|
super().tearDown()
|
|
24
21
|
|
|
25
22
|
def test_bug_check1(self):
|
|
26
23
|
self.logger_on()
|
|
27
|
-
sent = Sentinel(m_id=0, h=
|
|
24
|
+
sent = Sentinel(m_id=0, h=JsOrc.hook())
|
|
28
25
|
gph = Graph(m_id=0, h=sent._h)
|
|
29
26
|
sent.register_code(jtp.bug_check1)
|
|
30
27
|
test_walker = sent.run_architype("init")
|
|
@@ -34,7 +31,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
34
31
|
self.assertEqual(report[0][0], "THIS IS AN INTENT_LABEL")
|
|
35
32
|
|
|
36
33
|
def test_action_load_std_lib(self):
|
|
37
|
-
mast =
|
|
34
|
+
mast = JsOrc.super_master()
|
|
38
35
|
mast.sentinel_register(name="test", code=jtp.action_load_std_lib)
|
|
39
36
|
report = mast.general_interface_to_api(
|
|
40
37
|
api_name="walker_run", params={"name": "aload"}
|
|
@@ -42,7 +39,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
42
39
|
self.assertEqual(report[0], True)
|
|
43
40
|
|
|
44
41
|
def test_action_load_std_lib_only_super(self):
|
|
45
|
-
mast =
|
|
42
|
+
mast = JsOrc.master()
|
|
46
43
|
mast.sentinel_register(name="test", code=jtp.action_load_std_lib)
|
|
47
44
|
report = mast.general_interface_to_api(
|
|
48
45
|
api_name="walker_run", params={"name": "aload"}
|
|
@@ -51,7 +48,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
51
48
|
self.assertEqual(report[0], False)
|
|
52
49
|
|
|
53
50
|
def test_globals(self):
|
|
54
|
-
sent = Sentinel(m_id=0, h=
|
|
51
|
+
sent = Sentinel(m_id=0, h=JsOrc.hook())
|
|
55
52
|
gph = Graph(m_id=0, h=sent._h)
|
|
56
53
|
sent.register_code(jtp.globals)
|
|
57
54
|
test_walker = sent.run_architype("init")
|
|
@@ -61,7 +58,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
61
58
|
self.assertEqual(report, ["testing", 56])
|
|
62
59
|
|
|
63
60
|
def test_net_root_std_lib(self):
|
|
64
|
-
mast =
|
|
61
|
+
mast = JsOrc.master()
|
|
65
62
|
mast.sentinel_register(name="test", code=jtp.net_root_std_lib)
|
|
66
63
|
report = mast.general_interface_to_api(
|
|
67
64
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -71,7 +68,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
71
68
|
self.assertNotEqual(report[1][0], report[1][1])
|
|
72
69
|
|
|
73
70
|
def test_or_stmt(self):
|
|
74
|
-
mast =
|
|
71
|
+
mast = JsOrc.master()
|
|
75
72
|
mast.sentinel_register(name="test", code=jtp.or_stmt)
|
|
76
73
|
report = mast.general_interface_to_api(
|
|
77
74
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -79,7 +76,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
79
76
|
self.assertEqual(report, [[3.4, "Hello"]])
|
|
80
77
|
|
|
81
78
|
def test_nd_equals(self):
|
|
82
|
-
mast =
|
|
79
|
+
mast = JsOrc.master()
|
|
83
80
|
mast.sentinel_register(name="test", code=jtp.nd_equals_error_correct_line)
|
|
84
81
|
report = mast.general_interface_to_api(
|
|
85
82
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -89,7 +86,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
89
86
|
def test_strange_ability_bug(self):
|
|
90
87
|
import json
|
|
91
88
|
|
|
92
|
-
mast =
|
|
89
|
+
mast = JsOrc.master()
|
|
93
90
|
mast.sentinel_register(name="test", code=jtp.strange_ability_bug)
|
|
94
91
|
report = mast.general_interface_to_api(
|
|
95
92
|
api_name="walker_run", params={"name": "travel"}
|
|
@@ -109,7 +106,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
109
106
|
self.assertEqual(report, ["Showing", "Showing", "Showing", "Showing"])
|
|
110
107
|
|
|
111
108
|
def test_node_inheritance(self):
|
|
112
|
-
mast =
|
|
109
|
+
mast = JsOrc.master()
|
|
113
110
|
mast.sentinel_register(name="test", code=jtp.node_inheritance, auto_run="")
|
|
114
111
|
report = mast.general_interface_to_api(
|
|
115
112
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -131,7 +128,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
131
128
|
)
|
|
132
129
|
|
|
133
130
|
def test_inherited_ref(self):
|
|
134
|
-
mast =
|
|
131
|
+
mast = JsOrc.master()
|
|
135
132
|
mast.sentinel_register(name="test", code=jtp.inherited_ref, auto_run="")
|
|
136
133
|
report = mast.general_interface_to_api(
|
|
137
134
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -139,7 +136,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
139
136
|
self.assertEqual(len(report["report"]), 12)
|
|
140
137
|
|
|
141
138
|
def test_node_inheritance_chain_check(self):
|
|
142
|
-
mast =
|
|
139
|
+
mast = JsOrc.master()
|
|
143
140
|
mast.sentinel_register(
|
|
144
141
|
name="test", code=jtp.node_inheritance_chain_check, auto_run=""
|
|
145
142
|
)
|
|
@@ -149,7 +146,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
149
146
|
self.assertEqual(report["success"], False)
|
|
150
147
|
|
|
151
148
|
def test_global_reregistering(self):
|
|
152
|
-
mast =
|
|
149
|
+
mast = JsOrc.master()
|
|
153
150
|
mast.sentinel_register(name="test", code=jtp.global_reregistering)
|
|
154
151
|
self.assertTrue(mast.active_snt().is_active)
|
|
155
152
|
mast.sentinel_set(snt=mast.active_snt(), code=jtp.global_reregistering)
|
|
@@ -158,7 +155,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
158
155
|
self.assertTrue(mast.active_snt().is_active)
|
|
159
156
|
|
|
160
157
|
def test_vector_cos_sim_check(self):
|
|
161
|
-
mast =
|
|
158
|
+
mast = JsOrc.master()
|
|
162
159
|
mast.sentinel_register(name="test", code=jtp.vector_cos_sim_check, auto_run="")
|
|
163
160
|
report = mast.general_interface_to_api(
|
|
164
161
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -167,7 +164,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
167
164
|
self.assertEqual(type(report[0]), float)
|
|
168
165
|
|
|
169
166
|
def test_multi_breaks(self):
|
|
170
|
-
mast =
|
|
167
|
+
mast = JsOrc.master()
|
|
171
168
|
mast.sentinel_register(name="test", code=jtp.multi_breaks, auto_run="")
|
|
172
169
|
report = mast.general_interface_to_api(
|
|
173
170
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -176,7 +173,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
176
173
|
self.assertEqual(report[14], 180)
|
|
177
174
|
|
|
178
175
|
def test_reffy_deref_check(self):
|
|
179
|
-
mast =
|
|
176
|
+
mast = JsOrc.master()
|
|
180
177
|
mast.sentinel_register(name="test", code=jtp.reffy_deref_check, auto_run="")
|
|
181
178
|
report = mast.general_interface_to_api(
|
|
182
179
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -185,7 +182,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
185
182
|
self.assertTrue(report[1])
|
|
186
183
|
|
|
187
184
|
def test_vanishing_can_check(self):
|
|
188
|
-
mast =
|
|
185
|
+
mast = JsOrc.super_master()
|
|
189
186
|
mast.actions_load_local("jaseci/tests/infer.py")
|
|
190
187
|
mast.sentinel_register(name="test", code=jtp.vanishing_can_check, auto_run="")
|
|
191
188
|
mast.general_interface_to_api(api_name="walker_run", params={"name": "init"})
|
|
@@ -194,7 +191,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
194
191
|
)["report"]
|
|
195
192
|
self.assertEqual(report, ["2022-01-01T00:00:00"])
|
|
196
193
|
mast.propagate_access("public")
|
|
197
|
-
mast2 =
|
|
194
|
+
mast2 = JsOrc.super_master(h=mast._h)
|
|
198
195
|
mast.active_snt().run_architype(name="plain", kind="node", caller=mast2)
|
|
199
196
|
report = mast.general_interface_to_api(
|
|
200
197
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -202,7 +199,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
202
199
|
self.assertEqual(report, ["2022-01-01T00:00:00"])
|
|
203
200
|
|
|
204
201
|
def test_jasecilib_alias_list(self):
|
|
205
|
-
mast =
|
|
202
|
+
mast = JsOrc.master()
|
|
206
203
|
mast.sentinel_register(name="test", code=jtp.jasecilib_alias_list, auto_run="")
|
|
207
204
|
report = mast.general_interface_to_api(
|
|
208
205
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -210,7 +207,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
210
207
|
self.assertGreater(len(report[0].keys()), 3)
|
|
211
208
|
|
|
212
209
|
def test_jasecilib_params(self):
|
|
213
|
-
mast =
|
|
210
|
+
mast = JsOrc.master()
|
|
214
211
|
mast.sentinel_register(name="test", code=jtp.jasecilib_params, auto_run="")
|
|
215
212
|
report = mast.general_interface_to_api(
|
|
216
213
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -218,7 +215,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
218
215
|
self.assertIn("j_r_acc_ids", report[0][0].keys())
|
|
219
216
|
|
|
220
217
|
def test_jasecilib_create_user(self):
|
|
221
|
-
mast =
|
|
218
|
+
mast = JsOrc.master()
|
|
222
219
|
mast.sentinel_register(name="test", code=jtp.jasecilib_create_user, auto_run="")
|
|
223
220
|
report = mast.general_interface_to_api(
|
|
224
221
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -226,7 +223,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
226
223
|
self.assertEqual(report[0]["user"]["name"], "daman@gmail.com")
|
|
227
224
|
|
|
228
225
|
def test_root_is_node_type(self):
|
|
229
|
-
mast =
|
|
226
|
+
mast = JsOrc.master()
|
|
230
227
|
mast.sentinel_register(name="test", code=jtp.root_is_node_type, auto_run="")
|
|
231
228
|
report = mast.general_interface_to_api(
|
|
232
229
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -234,7 +231,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
234
231
|
self.assertEqual(report["report"][0], "JAC_TYPE.NODE")
|
|
235
232
|
|
|
236
233
|
def test_walker_with_exit_after_node(self):
|
|
237
|
-
mast =
|
|
234
|
+
mast = JsOrc.master()
|
|
238
235
|
mast.sentinel_register(
|
|
239
236
|
name="test", code=jtp.walker_with_exit_after_node, auto_run=""
|
|
240
237
|
)
|
|
@@ -244,7 +241,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
244
241
|
self.assertEqual(report["report"], [1, 1, 3, 1, 3, 1, 3, 1, 3, 43])
|
|
245
242
|
|
|
246
243
|
def test_depth_first_take(self):
|
|
247
|
-
mast =
|
|
244
|
+
mast = JsOrc.master()
|
|
248
245
|
mast.sentinel_register(name="test", code=jtp.depth_first_take, auto_run="")
|
|
249
246
|
report = mast.general_interface_to_api(
|
|
250
247
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -252,7 +249,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
252
249
|
self.assertEqual(report["report"], [1, 2, 3, 4, 5, 6, 7])
|
|
253
250
|
|
|
254
251
|
def test_breadth_first_take(self):
|
|
255
|
-
mast =
|
|
252
|
+
mast = JsOrc.master()
|
|
256
253
|
mast.sentinel_register(name="test", code=jtp.breadth_first_take, auto_run="")
|
|
257
254
|
report = mast.general_interface_to_api(
|
|
258
255
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -260,7 +257,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
260
257
|
self.assertEqual(report["report"], [1, 2, 5, 3, 4, 6, 7])
|
|
261
258
|
|
|
262
259
|
def test_inheritance_override_here_check(self):
|
|
263
|
-
mast =
|
|
260
|
+
mast = JsOrc.master()
|
|
264
261
|
mast.sentinel_register(
|
|
265
262
|
name="test", code=jtp.inheritance_override_here_check, auto_run=""
|
|
266
263
|
)
|
|
@@ -270,7 +267,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
270
267
|
self.assertEqual(report["report"], [9, 9, 10])
|
|
271
268
|
|
|
272
269
|
def test_dot_private_hidden(self):
|
|
273
|
-
mast =
|
|
270
|
+
mast = JsOrc.master()
|
|
274
271
|
mast.sentinel_register(name="test", code=jtp.dot_private_hidden, auto_run="")
|
|
275
272
|
mast.general_interface_to_api(api_name="walker_run", params={"name": "init"})
|
|
276
273
|
report = mast.general_interface_to_api(
|
|
@@ -279,7 +276,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
279
276
|
self.assertNotIn("j=", report)
|
|
280
277
|
|
|
281
278
|
def test_check_destroy_node_has_var(self):
|
|
282
|
-
mast =
|
|
279
|
+
mast = JsOrc.master()
|
|
283
280
|
mast.sentinel_register(
|
|
284
281
|
name="test", code=jtp.check_destroy_node_has_var, auto_run=""
|
|
285
282
|
)
|
|
@@ -295,7 +292,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
295
292
|
self.assertEqual(report["report"][0], "JAC_TYPE.NULL")
|
|
296
293
|
|
|
297
294
|
def test_for_loop_dict(self):
|
|
298
|
-
mast =
|
|
295
|
+
mast = JsOrc.master()
|
|
299
296
|
mast.sentinel_register(
|
|
300
297
|
name="test", code=jtp.check_dict_for_in_loop, auto_run=""
|
|
301
298
|
)
|
|
@@ -322,7 +319,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
322
319
|
)
|
|
323
320
|
|
|
324
321
|
def test_var_as_key_for_dict(self):
|
|
325
|
-
mast =
|
|
322
|
+
mast = JsOrc.master()
|
|
326
323
|
mast.sentinel_register(
|
|
327
324
|
name="test", code=jtp.check_dict_for_in_loop, auto_run=""
|
|
328
325
|
)
|
|
@@ -333,8 +330,34 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
333
330
|
self.assertEqual(res["report"], [{"key1": "key1", "key2": 2}])
|
|
334
331
|
self.assertIn("Key is not str type : <class 'int'>!", res["errors"][0])
|
|
335
332
|
|
|
333
|
+
def test_list_pairwise(self):
|
|
334
|
+
mast = JsOrc.master()
|
|
335
|
+
mast.sentinel_register(name="test", code=jtp.list_pairwise, auto_run="")
|
|
336
|
+
|
|
337
|
+
res = mast.general_interface_to_api(
|
|
338
|
+
api_name="walker_run", params={"name": "init"}
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
self.assertEqual(
|
|
342
|
+
res["report"],
|
|
343
|
+
[[[1, 2], [2, 3], [3, 4]]],
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
def test_list_unique(self):
|
|
347
|
+
mast = JsOrc.master()
|
|
348
|
+
mast.sentinel_register(name="test", code=jtp.list_unique, auto_run="")
|
|
349
|
+
|
|
350
|
+
res = mast.general_interface_to_api(
|
|
351
|
+
api_name="walker_run", params={"name": "init"}
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
self.assertEqual(
|
|
355
|
+
res["report"],
|
|
356
|
+
[[1, 2, 3, 4, 5]],
|
|
357
|
+
)
|
|
358
|
+
|
|
336
359
|
def test_new_additional_builtin(self):
|
|
337
|
-
mast =
|
|
360
|
+
mast = JsOrc.master()
|
|
338
361
|
mast.sentinel_register(name="test", code=jtp.check_new_builtin, auto_run="")
|
|
339
362
|
|
|
340
363
|
res = mast.general_interface_to_api(
|
|
@@ -347,7 +370,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
347
370
|
)
|
|
348
371
|
|
|
349
372
|
def test_continue_issue(self):
|
|
350
|
-
mast =
|
|
373
|
+
mast = JsOrc.master()
|
|
351
374
|
mast.sentinel_register(name="test", code=jtp.continue_issue, auto_run="")
|
|
352
375
|
res = mast.general_interface_to_api(
|
|
353
376
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -355,7 +378,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
355
378
|
self.assertEqual(res["report"], [1, 2, 3, 4, 5, 6, 7, 8, "apple"])
|
|
356
379
|
|
|
357
380
|
def test_registering_dict_as_ir(self):
|
|
358
|
-
mast =
|
|
381
|
+
mast = JsOrc.master()
|
|
359
382
|
mast.sentinel_register(name="test", code=jtp.continue_issue, auto_run="")
|
|
360
383
|
code_dict = mast.sentinel_get(snt=mast.active_snt(), mode="ir")
|
|
361
384
|
self.assertEqual(type(code_dict), dict)
|
|
@@ -365,9 +388,10 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
365
388
|
)
|
|
366
389
|
self.assertEqual(res["report"], [1, 2, 3, 4, 5, 6, 7, 8, "apple"])
|
|
367
390
|
|
|
391
|
+
@pytest.mark.order(2)
|
|
368
392
|
def test_async_syntax_with_celery(self):
|
|
369
|
-
mast =
|
|
370
|
-
if not
|
|
393
|
+
mast = JsOrc.master()
|
|
394
|
+
if not JsOrc.svc("task").is_running():
|
|
371
395
|
self.skip_test("Celery not running")
|
|
372
396
|
mast.sentinel_register(name="test", code=jtp.async_syntax, auto_run="")
|
|
373
397
|
res = mast.general_interface_to_api(
|
|
@@ -409,8 +433,8 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
409
433
|
self.assertEqual([2, 2], res["result"]["response"]["report"])
|
|
410
434
|
|
|
411
435
|
def test_async_syntax_without_celery(self):
|
|
412
|
-
mast =
|
|
413
|
-
|
|
436
|
+
mast = JsOrc.master()
|
|
437
|
+
JsOrc.svc("task").state = State.NOT_STARTED
|
|
414
438
|
mast.sentinel_register(name="test", code=jtp.async_syntax, auto_run="")
|
|
415
439
|
res = mast.general_interface_to_api(
|
|
416
440
|
api_name="walker_run",
|
|
@@ -437,11 +461,11 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
437
461
|
self.assertFalse(res["is_queued"])
|
|
438
462
|
self.assertEqual(2, res["result"])
|
|
439
463
|
|
|
440
|
-
|
|
464
|
+
JsOrc.svc("task").state = State.RUNNING
|
|
441
465
|
|
|
442
466
|
def test_async_sync_syntax_with_celery(self):
|
|
443
|
-
mast =
|
|
444
|
-
if not
|
|
467
|
+
mast = JsOrc.master()
|
|
468
|
+
if not JsOrc.svc("task").is_running():
|
|
445
469
|
self.skip_test("Celery not running")
|
|
446
470
|
mast.sentinel_register(name="test", code=jtp.async_syntax, auto_run="")
|
|
447
471
|
res = mast.general_interface_to_api(
|
|
@@ -483,8 +507,8 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
483
507
|
self.assertEqual([2, 2], res["result"]["response"]["report"])
|
|
484
508
|
|
|
485
509
|
def test_async_sync_syntax_without_celery(self):
|
|
486
|
-
mast =
|
|
487
|
-
|
|
510
|
+
mast = JsOrc.master()
|
|
511
|
+
JsOrc.svc("task").state = State.NOT_STARTED
|
|
488
512
|
mast.sentinel_register(name="test", code=jtp.async_syntax, auto_run="")
|
|
489
513
|
res = mast.general_interface_to_api(
|
|
490
514
|
api_name="walker_run",
|
|
@@ -511,11 +535,10 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
511
535
|
self.assertFalse(res["is_queued"])
|
|
512
536
|
self.assertEqual(2, res["result"])
|
|
513
537
|
|
|
514
|
-
|
|
538
|
+
JsOrc.svc("task").state = State.RUNNING
|
|
515
539
|
|
|
516
540
|
def test_block_scope_check(self):
|
|
517
|
-
mast =
|
|
518
|
-
mast._h.task.state = ServiceState.NOT_STARTED
|
|
541
|
+
mast = JsOrc.master()
|
|
519
542
|
mast.sentinel_register(name="test", code=jtp.block_scope_check, auto_run="")
|
|
520
543
|
res = mast.general_interface_to_api(
|
|
521
544
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -523,8 +546,7 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
523
546
|
self.assertEqual(res["report"][-1], 10)
|
|
524
547
|
|
|
525
548
|
def test_ignore_check(self):
|
|
526
|
-
mast =
|
|
527
|
-
mast._h.task.state = ServiceState.NOT_STARTED
|
|
549
|
+
mast = JsOrc.master()
|
|
528
550
|
res = mast.sentinel_register(name="test", code=jtp.ignore_check, auto_run="")
|
|
529
551
|
res = mast.general_interface_to_api(
|
|
530
552
|
api_name="walker_run", params={"name": "init"}
|
|
@@ -533,8 +555,8 @@ class JacTests(TestCaseHelper, TestCase):
|
|
|
533
555
|
|
|
534
556
|
@pytest.mark.order(1)
|
|
535
557
|
def test_module_on_async(self):
|
|
536
|
-
mast =
|
|
537
|
-
if not
|
|
558
|
+
mast = JsOrc.super_master()
|
|
559
|
+
if not JsOrc.svc("task").is_running():
|
|
538
560
|
self.skip_test("Celery not running")
|
|
539
561
|
|
|
540
562
|
with open("jaseci/tests/fixtures/non_existing_action.py", "w") as file:
|
jaseci/tests/test_stripe.py
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import stripe
|
|
2
2
|
from unittest.mock import Mock
|
|
3
|
-
from unittest import mock
|
|
4
3
|
from jaseci.utils.test_core import CoreTest, jac_testcase
|
|
5
|
-
from jaseci
|
|
6
|
-
from jaseci.svc.meta import MetaService
|
|
4
|
+
from jaseci import JsOrc
|
|
7
5
|
|
|
8
6
|
|
|
9
7
|
class StripeTests(CoreTest):
|
|
@@ -13,16 +11,14 @@ class StripeTests(CoreTest):
|
|
|
13
11
|
|
|
14
12
|
@classmethod
|
|
15
13
|
def setUpClass(cls):
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
config = JsOrc.settings("STRIPE_CONFIG")
|
|
15
|
+
config["enabled"] = True
|
|
16
|
+
config[
|
|
18
17
|
"api_key"
|
|
19
18
|
] = "sk_test_51JWUIeCZO78n7fsZnPvualWhmJg1DcCI332kKnWF3q2sKGwnPADjEmNblfFWi4pWAWPuJwHxpeSoJGc0J5ButHN900Q2xBz1se"
|
|
20
|
-
|
|
19
|
+
config["webhook_key"] = "test_webhook_key"
|
|
21
20
|
|
|
22
|
-
|
|
23
|
-
hook = meta.build_hook()
|
|
24
|
-
|
|
25
|
-
meta.get_service("stripe").reset(hook)
|
|
21
|
+
JsOrc.svc_reset("stripe")
|
|
26
22
|
|
|
27
23
|
super(StripeTests, cls).setUpClass()
|
|
28
24
|
stripe.Product.create = Mock()
|