8000 fixing indentations, fixed deletion of assertEqual · PNPtutorials/twilio-python@3c0b395 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3c0b395

Browse files
committed
fixing indentations, fixed deletion of assertEqual
1 parent 5500cba commit 3c0b395

File tree

3 files changed

+53
-47
lines changed

3 files changed

+53
-47
lines changed

tests/task_router/test_workflow_config.py

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def test_to_json(self):
1414
]
1515
def_target = WorkflowRuleTarget("WQ9963154bf3122d0a0558f3763951d916", "1==1", None, None)
1616
config = WorkflowConfig(rules, def_target)
17+
self.assertEqual(True, self.is_json(config.to_json()))
1718

1819
def test_from_json(self):
1920

@@ -85,7 +86,7 @@ def test_from_json_filter_friendly_name(self):
8586
'filters': [
8687
{
8788
'expression': 'type == "sales"',
88-
'filter_friendly_name': 'Sales',
89+
'friendly_name': 'Sales',
8990
'targets': [
9091
{
9192
'queue': 'WQec62de0e1148b8477f2e24579779c8b1',
@@ -95,7 +96,7 @@ def test_from_json_filter_friendly_name(self):
9596
},
9697
{
9798
'expression': 'type == "marketing"',
98-
'filter_friendly_name': 'Marketing',
99+
'friendly_name': 'Marketing',
99100
'targets': [
100101
{
101102
'queue': 'WQ2acd4c1a41ffadce5d1bac9e1ce2fa9f',
@@ -105,7 +106,7 @@ def test_from_json_filter_friendly_name(self):
105106
},
106107
{
107108
'expression': 'type == "support"',
108-
'filter_friendly_name': 'Support',
109+
'friendly_name': 'Support',
109110
'targets': [
110111
{
111112
'queue': 'WQe5eb317eb23500ade45087ea6522896c',
@@ -131,44 +132,46 @@ def test_from_json_filter_friendly_name(self):
131132
# convert back to json; should marshal as friendly_name
132133
config_json = config.to_json()
133134
expected_config_data = {
134-
"task_routing": {
135-
"default_filter": {
136-
"queue": "WQ05f810d2d130344fd56e3c91ece2e594"
137-
},
138-
"filters": [
139-
{
140-
"expression": "type == \"sales\"",
141-
"friendly_name": "Sales",
142-
"targets": [
143-
{
144-
"expression": "task.language IN worker.languages",
145-
"queue": "WQec62de0e1148b8477f2e24579779c8b1"
146-
}
147-
]
148-
},
149-
{
150-
"expression": "type == \"marketing\"",
151-
"friendly_name": "Marketing",
152-
"targets": [
153-
{
154-
"expression": "task.language IN worker.languages",
155-
"queue": "WQ2acd4c1a41ffadce5d1bac9e1ce2fa9f"
156-
}
157-
]
158-
},
159-
{
160-
"expression": "type == \"support\"",
161-
"friendly_name": "Support",
162-
"targets": [
163-
{
164-
"expression": "task.language IN worker.languages",
165-
"queue": "WQe5eb317eb23500ade45087ea6522896c"
166-
}
167-
]
168-
}
169-
]
170-
}
171-
}
135+
"task_routing":
136+
{
137+
"default_filter":
138+
{
139+
"queue": "WQ05f810d2d130344fd56e3c91ece2e594"
140+
},
141+
"filters": [
142+
{
143+
"expression": "type == \"sales\"",
144+
"friendly_name": "Sales",
145+
"targets": [
146+
{
147+
"expression": "task.language IN worker.languages",
148+
"queue": "WQec62de0e1148b8477f2e24579779c8b1"
149+
}
150+
]
151+
},
152+
{
153+
"expression": "type == \"marketing\"",
154+
"friendly_name": "Marketing",
155+
"targets": [
156+
{
157+
"expression": "task.language IN worker.languages",
158+
"queue": "WQ2acd4c1a41ffadce5d1bac9e1ce2fa9f"
159+
}
160+
]
161+
},
162+
{
163+
"expression": "type == \"support\"",
164+
"friendly_name": "Support",
165+
"targets": [
166+
{
167+
"expression": "task.language IN worker.languages",
168+
"queue": "WQe5eb317eb23500ade45087ea6522896c"
169+
}
170+
]
171+
}
172+
]
173+
}
174+
}
172175

173176
expected_config_json = json.dumps(expected_config_data,
174177
default=lambda o: o.__dict__,
@@ -1 2364 77,15 +180,10 @@ def test_from_json_filter_friendly_name(self):
177180

178181
self.assertEqual(config_json, expected_config_json)
179182

180-
181183
def is_json(self, myjson):
182184
try:
183185
json.loads(myjson)
184186
except ValueError as e:
185187
print(e)
186188
return False
187189
return True
188-
189-
if __name__ == '__main__':
190-
unittest.main()
191-

twilio-python.iml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module type="WEB_MODULE" version="4">
3+
<component name="NewModuleRootManager" inherit-compiler-output="true">
4+
<exclude-output />
5+
<content url="file://$MODULE_DIR$" />
6+
<orderEntry type="inheritedJdk" />
7+
<orderEntry type="sourceFolder" forTests="false" />
8+
</component>
9+
</module>

twilio/task_router/taskrouter_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from .workflow_rule import WorkflowRule
2-
from .workflow_ruletarget import WorkflowRuleTarget
32
import json
43

54

0 commit comments

Comments
 (0)
0