Skip to content

Commit 010ecb1

Browse files
committed
CV3-68-refactor(fixtures): refactor fixtures folder
- split fixture files in question to query and response - add output builder to dynamically build fixture outputs [Finishes CV3-68]
1 parent 6b5bb6e commit 010ecb1

File tree

67 files changed

+2264
-2320
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+2264
-2320
lines changed
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
from ..output.OutputBuilder import build
2+
from ..output.Error import error_item
3+
4+
null = None
5+
all_analytics_query_response = {
6+
"data": {
7+
"allAnalytics": {
8+
"checkinsPercentage": 0.0,
9+
"appBookingsPercentage": 0.0,
10+
"autoCancellationsPercentage": 0.0,
11+
"cancellationsPercentage": 0.0,
12+
"bookings": 1,
13+
"analytics": [
14+
{
15+
"roomName": "Entebbe",
16+
"cancellations": 0,
17+
"cancellationsPercentage": 0.0,
18+
"autoCancellations": 0,
19+
"numberOfBookings": 1,
20+
"checkins": 0,
21+
"checkinsPercentage": 0.0,
22+
"bookingsPercentageShare": 100.0,
23+
"appBookings": 0,
24+
"appBookingsPercentage": 0.0,
25+
"events": [
26+
{
27+
"durationInMinutes": 45
28+
}
29+
]
30+
},
31+
{
32+
"roomName": "Tana",
33+
"cancellations": 0,
34+
"cancellationsPercentage": 0.0,
35+
"autoCancellations": 0,
36+
"numberOfBookings": 0,
37+
"checkins": 0,
38+
"checkinsPercentage": 0.0,
39+
"bookingsPercentageShare": 0.0,
40+
"appBookings": 0,
41+
"appBookingsPercentage": 0.0,
42+
"events": [
43+
{
44+
"durationInMinutes": 0
45+
}
46+
]
47+
}
48+
],
49+
"bookingsCount": [
50+
{
51+
"totalBookings": 1,
52+
"period": "Jul 11 2018"
53+
},
54+
{
55+
'totalBookings': 0,
56+
'period': 'Jul 12 2018'
57+
}
58+
]
59+
}
60+
}
61+
}
62+
63+
aaq_error = error_item
64+
aaq_error.message = "Location Id does not exist"
65+
aaq_error.locations = [{"line": 3, "column": 7}]
66+
aaq_error.path = ["allAnalytics"]
67+
aaq_data = {"allAnalytics": None}
68+
69+
all_analytics_query_response_super_admin_with_invalid_locationid = build(
70+
aaq_error.build_error(aaq_error),
71+
aaq_data
72+
)
73+
all_analytics_query_response_super_admin = {
74+
"data": {
75+
"allAnalytics": {
76+
"checkinsPercentage": 0.0,
77+
"appBookingsPercentage": 0.0,
78+
"autoCancellationsPercentage": 0.0,
79+
"cancellationsPercentage": 0.0,
80+
"bookings": 12,
81+
"analytics": [
82+
{
83+
"roomName": "Oculus",
84+
"cancellations": 0,
85+
"cancellationsPercentage": 0.0,
86+
"autoCancellations": 0,
87+
"numberOfBookings": 6,
88+
"checkins": 0,
89+
"checkinsPercentage": 0.0,
90+
"bookingsPercentageShare": 50.0,
91+
"appBookings": 0,
92+
"appBookingsPercentage": 0.0,
93+
"events": [
94+
{
95+
"durationInMinutes": 890
96+
}
97+
]
98+
},
99+
{
100+
"roomName": "Krypton",
101+
"cancellations": 0,
102+
"cancellationsPercentage": 0.0,
103+
"autoCancellations": 0,
104+
"numberOfBookings": 3,
105+
"checkins": 0,
106+
"checkinsPercentage": 0.0,
107+
"bookingsPercentageShare": 25.0,
108+
"appBookings": 0,
109+
"appBookingsPercentage": 0.0,
110+
"events": [
111+
{
112+
"durationInMinutes": 155
113+
}
114+
]
115+
},
116+
{
117+
"roomName": "Bujumbura",
118+
"cancellations": 0,
119+
"cancellationsPercentage": 0.0,
120+
"autoCancellations": 0,
121+
"numberOfBookings": 3,
122+
"checkins": 0,
123+
"checkinsPercentage": 0.0,
124+
"bookingsPercentageShare": 25.0,
125+
"appBookings": 0,
126+
"appBookingsPercentage": 0.0,
127+
"events": [
128+
{
129+
"durationInMinutes": 92
130+
}
131+
]
132+
},
133+
{
134+
"roomName": "Kampala",
135+
"cancellations": 0,
136+
"cancellationsPercentage": 0.0,
137+
"autoCancellations": 0,
138+
"numberOfBookings": 0,
139+
"checkins": 0,
140+
"checkinsPercentage": 0.0,
141+
"bookingsPercentageShare": 0.0,
142+
"appBookings": 0,
143+
"appBookingsPercentage": 0.0,
144+
"events": [
145+
{
146+
"durationInMinutes": 0
147+
}
148+
]
149+
},
150+
{
151+
"roomName": "Algiers",
152+
"cancellations": 0,
153+
"cancellationsPercentage": 0.0,
154+
"autoCancellations": 0,
155+
"numberOfBookings": 0,
156+
"checkins": 0,
157+
"checkinsPercentage": 0.0,
158+
"bookingsPercentageShare": 0.0,
159+
"appBookings": 0,
160+
"appBookingsPercentage": 0.0,
161+
"events": [
162+
{
163+
"durationInMinutes": 0
164+
}
165+
]
166+
}
167+
],
168+
"bookingsCount": [
169+
{
170+
"totalBookings": 7,
171+
"period": "Jul 11 2018"
172+
},
173+
{
174+
"totalBookings": 5,
175+
"period": "Jul 12 2018"
176+
}
177+
]
178+
}
179+
}
180+
}

fixtures/analytics/query_all_analytics_fixtures.py

Lines changed: 0 additions & 187 deletions
Original file line numberDiff line numberDiff line change
@@ -59,193 +59,6 @@
5959
}
6060
'''
6161

62-
all_analytics_query_response = {
63-
"data": {
64-
"allAnalytics": {
65-
"checkinsPercentage": 0.0,
66-
"appBookingsPercentage": 0.0,
67-
"autoCancellationsPercentage": 0.0,
68-
"cancellationsPercentage": 0.0,
69-
"bookings": 1,
70-
"analytics": [
71-
{
72-
"roomName": "Entebbe",
73-
"cancellations": 0,
74-
"cancellationsPercentage": 0.0,
75-
"autoCancellations": 0,
76-
"numberOfBookings": 1,
77-
"checkins": 0,
78-
"checkinsPercentage": 0.0,
79-
"bookingsPercentageShare": 100.0,
80-
"appBookings": 0,
81-
"appBookingsPercentage": 0.0,
82-
"events": [
83-
{
84-
"durationInMinutes": 45
85-
}
86-
]
87-
},
88-
{
89-
"roomName": "Tana",
90-
"cancellations": 0,
91-
"cancellationsPercentage": 0.0,
92-
"autoCancellations": 0,
93-
"numberOfBookings": 0,
94-
"checkins": 0,
95-
"checkinsPercentage": 0.0,
96-
"bookingsPercentageShare": 0.0,
97-
"appBookings": 0,
98-
"appBookingsPercentage": 0.0,
99-
"events": [
100-
{
101-
"durationInMinutes": 0
102-
}
103-
]
104-
}
105-
],
106-
"bookingsCount": [
107-
{
108-
"totalBookings": 1,
109-
"period": "Jul 11 2018"
110-
},
111-
{
112-
'totalBookings': 0,
113-
'period': 'Jul 12 2018'
114-
}
115-
]
116-
}
117-
}
118-
}
119-
120-
all_analytics_query_response_super_admin_with_invalid_locationid = {
121-
"errors": [
122-
{
123-
"message": "Location Id does not exist",
124-
"locations": [
125-
{
126-
"line": 3,
127-
"column": 7
128-
}
129-
],
130-
"path": [
131-
"allAnalytics"
132-
]
133-
}
134-
],
135-
"data": {
136-
"allAnalytics": None
137-
}
138-
}
139-
140-
all_analytics_query_response_super_admin = {
141-
"data": {
142-
"allAnalytics": {
143-
"checkinsPercentage": 0.0,
144-
"appBookingsPercentage": 0.0,
145-
"autoCancellationsPercentage": 0.0,
146-
"cancellationsPercentage": 0.0,
147-
"bookings": 12,
148-
"analytics": [
149-
{
150-
"roomName": "Oculus",
151-
"cancellations": 0,
152-
"cancellationsPercentage": 0.0,
153-
"autoCancellations": 0,
154-
"numberOfBookings": 6,
155-
"checkins": 0,
156-
"checkinsPercentage": 0.0,
157-
"bookingsPercentageShare": 50.0,
158-
"appBookings": 0,
159-
"appBookingsPercentage": 0.0,
160-
"events": [
161-
{
162-
"durationInMinutes": 890
163-
}
164-
]
165-
},
166-
{
167-
"roomName": "Krypton",
168-
"cancellations": 0,
169-
"cancellationsPercentage": 0.0,
170-
"autoCancellations": 0,
171-
"numberOfBookings": 3,
172-
"checkins": 0,
173-
"checkinsPercentage": 0.0,
174-
"bookingsPercentageShare": 25.0,
175-
"appBookings": 0,
176-
"appBookingsPercentage": 0.0,
177-
"events": [
178-
{
179-
"durationInMinutes": 155
180-
}
181-
]
182-
},
183-
{
184-
"roomName": "Bujumbura",
185-
"cancellations": 0,
186-
"cancellationsPercentage": 0.0,
187-
"autoCancellations": 0,
188-
"numberOfBookings": 3,
189-
"checkins": 0,
190-
"checkinsPercentage": 0.0,
191-
"bookingsPercentageShare": 25.0,
192-
"appBookings": 0,
193-
"appBookingsPercentage": 0.0,
194-
"events": [
195-
{
196-
"durationInMinutes": 92
197-
}
198-
]
199-
},
200-
{
201-
"roomName": "Kampala",
202-
"cancellations": 0,
203-
"cancellationsPercentage": 0.0,
204-
"autoCancellations": 0,
205-
"numberOfBookings": 0,
206-
"checkins": 0,
207-
"checkinsPercentage": 0.0,
208-
"bookingsPercentageShare": 0.0,
209-
"appBookings": 0,
210-
"appBookingsPercentage": 0.0,
211-
"events": [
212-
{
213-
"durationInMinutes": 0
214-
}
215-
]
216-
},
217-
{
218-
"roomName": "Algiers",
219-
"cancellations": 0,
220-
"cancellationsPercentage": 0.0,
221-
"autoCancellations": 0,
222-
"numberOfBookings": 0,
223-
"checkins": 0,
224-
"checkinsPercentage": 0.0,
225-
"bookingsPercentageShare": 0.0,
226-
"appBookings": 0,
227-
"appBookingsPercentage": 0.0,
228-
"events": [
229-
{
230-
"durationInMinutes": 0
231-
}
232-
]
233-
}
234-
],
235-
"bookingsCount": [
236-
{
237-
"totalBookings": 7,
238-
"period": "Jul 11 2018"
239-
},
240-
{
241-
"totalBookings": 5,
242-
"period": "Jul 12 2018"
243-
}
244-
]
245-
}
246-
}
247-
}
248-
24962
analytics_query_for_date_ranges = '''
25063
query {
25164
allAnalytics(startDate:"jul 11 2020", endDate:"jul 12 2018") {

0 commit comments

Comments
 (0)