Skip to content

Commit b4f0c46

Browse files
Mireille NiwemuhuzaMireille Niwemuhuza
Mireille Niwemuhuza
authored and
Mireille Niwemuhuza
committed
CV3-77-story(base.py): clean up base.py test file
- clean up this file by putting test data in a separate data file that is loaded by base.py [Delivers CV3-77]
1 parent 03c5c13 commit b4f0c46

23 files changed

+375
-197
lines changed

fixtures/location/all_locations_fixtures.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@
5050
}
5151
]
5252
},
53+
{
54+
"name": "Kigali",
55+
"abbreviation": "KGL",
56+
"rooms": []
57+
},
5358
{
5459
"name": "Lagos",
5560
"abbreviation": "LOS",
@@ -112,6 +117,7 @@
112117
},
113118
]},
114119
{'rooms': []},
120+
{'rooms': []},
115121
{'rooms': []}
116122
]
117123
}

fixtures/response/room_response_fixture.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
null = None
44

5-
start_date = (datetime.date.today() - datetime.timedelta(
5+
created_at = 'Nov 30 2019'
6+
created_at_datetime = datetime.datetime.strptime(created_at, '%b %d %Y')
7+
start_date = (created_at_datetime - datetime.timedelta(
68
days=2)).strftime('%b %d %Y')
7-
end_date = datetime.date.today().strftime('%b %d %Y')
9+
end_date = created_at_datetime.strftime('%b %d %Y')
810
invalid_start_date = (datetime.date.today() + datetime.timedelta(
911
days=10)).strftime('%b %d %Y')
1012
invalid_end_date = (datetime.date.today() + datetime.timedelta(

test_data/devices.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"table_name": "devices",
3+
"data": [
4+
{
5+
"last_seen":"2018-06-08T11:17:58.785136",
6+
"date_added":"2018-06-08T11:17:58.785136",
7+
"name":"Samsung",
8+
"location":"Kampala",
9+
"device_type":"External Display",
10+
"room_id":1,
11+
"state":"active"
12+
}
13+
]
14+
}

test_data/events_table.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"table_name": "events",
3+
"data": [
4+
{
5+
"event_id":"test_id5",
6+
"room_id":1,
7+
"event_title":"Onboarding",
8+
"start_time":"2018-07-11T09:00:00Z",
9+
"end_time":"2018-07-11T09:45:00Z",
10+
"number_of_participants":4,
11+
"checked_in":false,
12+
"cancelled":false
13+
}
14+
]
15+
}

test_data/locations.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"table_name": "locations",
3+
"data": [
4+
{
5+
"name":"Kampala",
6+
"abbreviation":"KLA"
7+
},
8+
{
9+
"name": "Nairobi",
10+
"abbreviation": "NBO"
11+
},
12+
{
13+
"name": "Lagos",
14+
"abbreviation": "LOS"
15+
},
16+
{
17+
"name": "Kigali",
18+
"abbreviation": "KGL"
19+
}
20+
]
21+
}

test_data/office_structures.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"table_name": "structures",
3+
"data": [
4+
{
5+
"id":"C56A4180-65AA-42EC-A945-5FD21DEC0518",
6+
"name":"Epic Tower",
7+
"tag":"Lagos Building",
8+
"location_id":1
9+
},
10+
{
11+
"id": "C56A4180-65AA-42EC-A945-5FD21DEC0519",
12+
"name": "Gold Coast",
13+
"tag": "First Floor",
14+
"parent_id":"C56A4180-65AA-42EC-A945-5FD21DEC0518",
15+
"location_id": 1
16+
}
17+
]
18+
}

test_data/questions.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"table_name": "questions",
3+
"data": [
4+
{
5+
"question_type":"rate",
6+
"question_title":"Rating Feedback",
7+
"question":"How will you rate the brightness of the room",
8+
"start_date":"20 Nov 2018",
9+
"end_date":"28 Nov 2018",
10+
"is_active":true
11+
},
12+
{
13+
"question_type": "check",
14+
"question_title": "check Feedback",
15+
"question": "Is there anything missing in the room",
16+
"check_options":["apple tv", "whiteboard", "maker pen"],
17+
"start_date": "20 Nov 2018",
18+
"end_date": "30 Nov 2018",
19+
"is_active": true
20+
},
21+
{
22+
"question_type":"input",
23+
"question_title":"input Feedback",
24+
"question":"Any other suggestion",
25+
"start_date":"20 Nov 2018",
26+
"end_date":"28 Nov 2018"
27+
},
28+
{
29+
"question_type":"check",
30+
"question_title":"Missing item",
31+
"question":"Anything missing in the room?",
32+
"check_options":["duster"],
33+
"start_date":"20 Nov 2018",
34+
"end_date":"30 Nov 2018",
35+
"is_active":true
36+
}
37+
]
38+
}

test_data/resources.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"table_name": "resources",
3+
"data": [
4+
{
5+
"name":"Markers",
6+
"quantity":3
7+
}
8+
]
9+
}

test_data/responses.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"table_name": "responses",
3+
"data": [
4+
{
5+
"question_id":1,
6+
"room_id":1,
7+
"question_type":"rate",
8+
"created_date": "2019-11-30 16:20:24.885363",
9+
"response":"1",
10+
"resolved":false
11+
},
12+
{
13+
"question_id":2,
14+
"room_id":1,
15+
"question_type":"check",
16+
"created_date": "2019-11-30 16:20:24.885363",
17+
"response":["marker pen", "apple tv"],
18+
"resolved":true
19+
},
20+
{
21+
"question_id":4,
22+
"room_id":2,
23+
"question_type":"check",
24+
"created_date":"2019-11-30 16:20:24.885363",
25+
"response":["duster"],
26+
"resolved":true,
27+
"state":"archived"
28+
}
29+
]
30+
}

test_data/roles.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"table_name": "roles",
3+
"data": [
4+
{
5+
"role": "Admin"
6+
},
7+
{
8+
"role": "Test"
9+
},
10+
{
11+
"role": "Super Admin"
12+
}
13+
]
14+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"table_name": "room_tags",
3+
"data": [
4+
{
5+
"tag_id": 1,
6+
"room_id": 1
7+
},
8+
{
9+
"tag_id": 1,
10+
"room_id": 2
11+
}
12+
]
13+
}

test_data/rooms.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"table_name": "rooms",
3+
"data": [
4+
{
5+
"name":"Entebbe",
6+
"room_type":"meeting",
7+
"capacity":6,
8+
"location_id": 1,
9+
"structure_id":"851ae8b3-48dd-46b5-89bc-ca3f8111ad87",
10+
"calendar_id":"[email protected]",
11+
"image_url":"https://www.officelovin.com/wp-content/uploads/2016/10/andela-office-main-1.jpg",
12+
"room_labels":
13+
[
14+
"1st Floor",
15+
"Wing A"
16+
]
17+
},
18+
{
19+
"name": "Tana",
20+
"room_type": "meeting",
21+
"capacity": 14,
22+
"location_id":1,
23+
"structure_id": "851ae8b3-48dd-46b5-89bc-ca3f8111ad87",
24+
"calendar_id": "[email protected]",
25+
"image_url": "https://www.officelovin.com/wp-content/uploads/2016/10/andela-office-main-1.jpg",
26+
"room_labels": [
27+
"1st Floor",
28+
"Wing B"
29+
]
30+
}
31+
]
32+
33+
}

test_data/structures.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"table_name": "office_structures",
3+
"data": [
4+
{
5+
"structure_id":"b05fc5f2-b4aa-4f48-a8fb-30bdcc3fc968",
6+
"level":1,
7+
"name":"Epic tower",
8+
"parent_id":"1",
9+
"parent_title":"parent_title",
10+
"tag":"Building",
11+
"location_id":1,
12+
"position":1
13+
}
14+
]
15+
}

test_data/tags.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"table_name": "tags",
3+
"data": [
4+
{
5+
"name":"Block-B",
6+
"color":"green",
7+
"description":"The description"
8+
},
9+
{
10+
"name": "Block-C",
11+
"color": "blue",
12+
"description": "The description"
13+
}
14+
]
15+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"table_name": "users_roles",
3+
"data": [
4+
{
5+
"user_id": 1,
6+
"role_id": 1
7+
},
8+
{
9+
"user_id": 2,
10+
"role_id": 1
11+
}
12+
]
13+
}

test_data/users_table.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"table_name": "users",
3+
"data": [
4+
{
5+
"email": "[email protected]",
6+
"name": "Peter Walugembe",
7+
"picture": "https://www.andela.com/walugembe",
8+
"location": "Kampala"
9+
},
10+
{
11+
"email":"[email protected]",
12+
"name":"Peter Adeoye",
13+
"picture":"https://www.andela.com/adeoye",
14+
"location":"Lagos"
15+
}
16+
]
17+
}

0 commit comments

Comments
 (0)