Ava2lon commited on
Commit
d884cb4
·
verified ·
1 Parent(s): 1319f7a

Delete tests

Browse files
tests/__pycache__/conftest.cpython-314.pyc DELETED
Binary file (582 Bytes)
 
tests/__pycache__/test_api.cpython-314.pyc DELETED
Binary file (10.8 kB)
 
tests/conftest.py DELETED
@@ -1,14 +0,0 @@
1
- import os
2
-
3
- os.environ["ENVIRONMENT"] = "test"
4
- os.environ["AUTH_REQUIRED"] = "false"
5
-
6
- import pytest
7
- from fastapi.testclient import TestClient
8
-
9
- from app.main import app
10
-
11
-
12
- @pytest.fixture
13
- def client():
14
- return TestClient(app)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tests/test_api.py DELETED
@@ -1,241 +0,0 @@
1
- def test_health(client):
2
- response = client.get("/health")
3
- assert response.status_code == 200
4
- assert response.json()["status"] == "ok"
5
-
6
-
7
- def test_generate_and_validate_workflow(client):
8
- generated = client.post(
9
- "/generate-workflow",
10
- json={
11
- "prompt": (
12
- "Read Gmail invoice attachments, extract the data, store it in "
13
- "Supabase, and send a Slack notification"
14
- )
15
- },
16
- )
17
- assert generated.status_code == 200
18
- workflow = generated.json()["workflow"]
19
- assert len(workflow["nodes"]) == 4
20
- assert len(workflow["edges"]) == 3
21
-
22
- validation = client.post("/validate", json={"workflow": workflow})
23
- assert validation.status_code == 200
24
- body = validation.json()
25
- assert body["valid"] is False
26
- assert any(issue["code"] == "missing_credentials" for issue in body["issues"])
27
-
28
-
29
- def test_cycle_detection(client):
30
- workflow = {
31
- "name": "Cycle",
32
- "active": False,
33
- "nodes": [
34
- {
35
- "id": "a",
36
- "type": "workflow",
37
- "position": {"x": 0, "y": 0},
38
- "data": {
39
- "label": "Webhook",
40
- "type": "n8n-nodes-base.webhook",
41
- "typeVersion": 2,
42
- "category": "trigger",
43
- "parameters": {"path": "test"},
44
- },
45
- },
46
- {
47
- "id": "b",
48
- "type": "workflow",
49
- "position": {"x": 300, "y": 0},
50
- "data": {
51
- "label": "Edit Fields",
52
- "type": "n8n-nodes-base.set",
53
- "typeVersion": 3,
54
- "category": "core",
55
- "parameters": {"value": 1},
56
- },
57
- },
58
- ],
59
- "edges": [
60
- {"id": "a-b", "source": "a", "target": "b"},
61
- {"id": "b-a", "source": "b", "target": "a"},
62
- ],
63
- "settings": {},
64
- "meta": {},
65
- }
66
- response = client.post("/validate", json={"workflow": workflow})
67
- assert response.status_code == 200
68
- assert any(issue["code"] == "infinite_loop" for issue in response.json()["issues"])
69
-
70
-
71
- def test_n8n_import_export_round_trip(client):
72
- n8n = {
73
- "name": "Round trip",
74
- "nodes": [
75
- {
76
- "id": "one",
77
- "name": "Webhook",
78
- "type": "n8n-nodes-base.webhook",
79
- "typeVersion": 2,
80
- "position": [10, 20],
81
- "parameters": {"path": "incoming"},
82
- },
83
- {
84
- "id": "two",
85
- "name": "Edit Fields",
86
- "type": "n8n-nodes-base.set",
87
- "typeVersion": 3,
88
- "position": [300, 20],
89
- "parameters": {"assignments": {}},
90
- },
91
- ],
92
- "connections": {
93
- "Webhook": {
94
- "main": [[{"node": "Edit Fields", "type": "main", "index": 0}]]
95
- }
96
- },
97
- "settings": {},
98
- }
99
- imported = client.post(
100
- "/import",
101
- json={"content": __import__("json").dumps(n8n), "source": "json"},
102
- )
103
- assert imported.status_code == 200
104
- workflow = imported.json()
105
- assert len(workflow["edges"]) == 1
106
-
107
- exported = client.post(
108
- "/export", json={"workflow": workflow, "format": "n8n"}
109
- )
110
- assert exported.status_code == 200
111
- assert exported.json()["connections"]["Webhook"]["main"][0][0]["node"] == "Edit Fields"
112
-
113
-
114
- def test_simulation_testing_cost_and_diff(client):
115
- generated = client.post(
116
- "/generate-workflow",
117
- json={"prompt": "Create a webhook workflow that stores data in Supabase"},
118
- ).json()["workflow"]
119
-
120
- simulation = client.post(
121
- "/simulate",
122
- json={"workflow": generated, "input_data": {"email": "a@example.com"}},
123
- )
124
- assert simulation.status_code == 200
125
- assert simulation.json()["status"] == "success"
126
- assert len(simulation.json()["trace"]) == len(generated["nodes"])
127
-
128
- expected_last = generated["nodes"][-1]["data"]["label"]
129
- tests = client.post(
130
- "/test-workflow",
131
- json={
132
- "workflow": generated,
133
- "cases": [
134
- {
135
- "name": "happy path",
136
- "input_data": {},
137
- "assertions": [
138
- {"path": "_lastNode", "operator": "equals", "expected": expected_last}
139
- ],
140
- }
141
- ],
142
- },
143
- )
144
- assert tests.status_code == 200
145
- assert tests.json()["passed"] == 1
146
-
147
- cost = client.post(
148
- "/estimate-cost",
149
- json={"workflow": generated, "executions_per_month": 10_000},
150
- )
151
- assert cost.status_code == 200
152
- assert cost.json()["executions_per_month"] == 10_000
153
-
154
- changed = {**generated, "name": "Changed", "nodes": generated["nodes"][:-1]}
155
- diff = client.post("/diff", json={"before": generated, "after": changed})
156
- assert diff.status_code == 200
157
- assert len(diff.json()["removed_nodes"]) == 1
158
-
159
-
160
- def test_local_share_link_round_trip(client):
161
- workflow = client.post(
162
- "/generate-workflow",
163
- json={"prompt": "Create a webhook workflow that sends a Slack message"},
164
- ).json()["workflow"]
165
- workflow["id"] = "local-workflow"
166
- shared = client.post(
167
- "/shares",
168
- json={
169
- "workflow_id": workflow["id"],
170
- "workflow": workflow,
171
- "permission": "copy",
172
- "expires_in_days": 7,
173
- },
174
- )
175
- assert shared.status_code == 200
176
- token = shared.json()["url"].rsplit("/", 1)[-1]
177
- public = client.get(f"/shares/{token}")
178
- assert public.status_code == 200
179
- assert public.json()["permission"] == "copy"
180
- assert public.json()["workflow"]["name"] == workflow["name"]
181
-
182
-
183
- def test_intelligence_release_and_package_endpoints(client):
184
- workflow = client.post(
185
- "/generate-workflow",
186
- json={"prompt": "Read customer email invoices and store amounts in Supabase"},
187
- ).json()["workflow"]
188
-
189
- quality = client.post("/quality", json={"workflow": workflow})
190
- assert quality.status_code == 200
191
- assert 0 <= quality.json()["overall"] <= 100
192
-
193
- lineage = client.post("/lineage", json={"workflow": workflow})
194
- assert lineage.status_code == 200
195
- assert "fields" in lineage.json()
196
-
197
- contract = client.post(
198
- "/contract-test",
199
- json={
200
- "workflow": workflow,
201
- "sample_data": {"email": "a@example.com", "amount": 15},
202
- "expected_schema": {"email": "string", "amount": "number"},
203
- },
204
- )
205
- assert contract.status_code == 200
206
- assert contract.json()["valid"] is True
207
-
208
- release = client.post(
209
- "/release-plan",
210
- json={"workflow": workflow, "strategy": "shadow", "traffic_percentage": 0},
211
- )
212
- assert release.status_code == 200
213
- assert release.json()["requires_approval"] is True
214
-
215
- package = client.post(
216
- "/package",
217
- json={"workflow": workflow, "tests": [], "contracts": {}, "environments": {}},
218
- )
219
- assert package.status_code == 200
220
- assert package.json()["manifest"]["format"] == "flowforge.workflow-package/v1"
221
-
222
-
223
- def test_webhook_redaction_and_replay(client):
224
- workflow = client.post(
225
- "/generate-workflow",
226
- json={"prompt": "Create a webhook that sends a notification"},
227
- ).json()["workflow"]
228
- inspected = client.post(
229
- "/inspect-webhook",
230
- json={"payload": {"email": "a@example.com", "token": "secret", "event": "paid"}},
231
- )
232
- assert inspected.status_code == 200
233
- assert inspected.json()["payload"]["email"] == "[REDACTED]"
234
- assert inspected.json()["payload"]["token"] == "[REDACTED]"
235
-
236
- replay = client.post(
237
- "/replay",
238
- json={"workflow": workflow, "node_id": workflow["nodes"][-1]["id"], "input_data": {}},
239
- )
240
- assert replay.status_code == 200
241
- assert len(replay.json()["trace"]) == 1