Skip to content

Commit 1bad27a

Browse files
committed
wip: migrate hub
1 parent 2871558 commit 1bad27a

4 files changed

Lines changed: 27 additions & 26 deletions

File tree

tests/modules/test_api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
class TestAPI(unittest.TestCase):
1515
'''Collection of tests for the api module'''
1616

17-
1817
def test_pull_data_dump(self):
18+
'''Test the pull_data_dump function'''
19+
1920
system_json = StringIO("""{
2021
"serial": "536780dfe639468e8e23fc568006950d",
2122
"timezone": "America/New_York",

tests/modules/test_log.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ def reset(self):
2828
}
2929

3030
if __name__ == '__main__':
31-
unittest.main()
31+
unittest.main()

tests/modules/test_lookup.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Test_LookUp_AccessRequest(unittest.TestCase):
9090
'''Access Request Tests'''
9191

9292
def setUp(self):
93-
self.systemJSON = StringIO(
93+
self.system_json = StringIO(
9494
'''{
9595
"serial": "536780dfe639468e8e23fc568006950d",
9696
"timezone": "America/New_York",
@@ -117,7 +117,7 @@ def setUp(self):
117117
]'''
118118
)
119119

120-
self.membersJSON = StringIO(
120+
self.members_json = StringIO(
121121
'''[
122122
{
123123
"cardNumber": "313233343536373839",
@@ -136,7 +136,7 @@ def setUp(self):
136136
]'''
137137
)
138138

139-
self.ownersJSON = StringIO(
139+
self.owners_json = StringIO(
140140
'''[
141141
{
142142
"facility": "3b9fdc97-9649-4c80-8b48-10df647bd032",
@@ -154,7 +154,7 @@ def setUp(self):
154154
]'''
155155
)
156156

157-
self.permissionsJSON = StringIO(
157+
self.permissions_json = StringIO(
158158
'''[
159159
{
160160
"id": 1,
@@ -178,7 +178,7 @@ def setUp(self):
178178

179179
# ----------------------------------- _alt ----------------------------------- #
180180

181-
self.systemJSON = StringIO(
181+
self.system_json = StringIO(
182182
'''{
183183
"serial": "536780dfe639468e8e23fc568006950d",
184184
"timezone": "America/New_York",
@@ -205,7 +205,7 @@ def setUp(self):
205205
]'''
206206
)
207207

208-
self.membersJSON_alt = StringIO(
208+
self.members_json_alt = StringIO(
209209
'''[
210210
{
211211
"cardNumber": "313233343536373839",
@@ -224,7 +224,7 @@ def setUp(self):
224224
]'''
225225
)
226226

227-
self.ownersJSON_alt = StringIO(
227+
self.owners_json_alt = StringIO(
228228
'''[
229229
{
230230
"facility": "3b9fdc97-9649-4c80-8b48-10df647bd032",
@@ -242,7 +242,7 @@ def setUp(self):
242242
]'''
243243
)
244244

245-
self.permissionsJSON_alt = StringIO(
245+
self.permissions_json_alt = StringIO(
246246
'''[
247247
{
248248
"id": 1,
@@ -267,11 +267,11 @@ def setUp(self):
267267
def test_files_opened(self):
268268
with patch('modules.rec_lookup.open') as mock_open:
269269
mock_open.side_effect = [
270-
self.systemJSON,
270+
self.system_json,
271271
self.nodes_json, # Opened from conversion function.
272-
self.ownersJSON, # Opened from owner check function.
273-
self.membersJSON, # Opened from get_details function.
274-
self.permissionsJSON, # Opened from get_group_details function.
272+
self.owners_json, # Opened from owner check function.
273+
self.members_json, # Opened from get_details function.
274+
self.permissions_json, # Opened from get_group_details function.
275275
]
276276

277277
rec_lookup.access_request(313131, '0011223344556677')
@@ -294,44 +294,44 @@ def test_mac_to_id(self):
294294

295295
def test_is_owner(self):
296296
with patch('modules.rec_lookup.open') as mock_open:
297-
mock_open.return_value = self.ownersJSON
297+
mock_open.return_value = self.owners_json
298298

299299
owner = rec_lookup.is_owner('30393837363534333231')
300300
mock_open.assert_called()
301301
self.assertTrue(owner)
302302

303303
with patch('modules.rec_lookup.open') as mock_open:
304-
mock_open.return_value = self.ownersJSON_alt
304+
mock_open.return_value = self.owners_json_alt
305305

306306
owner = rec_lookup.is_owner('99393837363534333231')
307307
mock_open.assert_called()
308308
self.assertFalse(owner)
309309

310310
def test_get_details(self):
311311
with patch('modules.rec_lookup.open') as mock_open:
312-
mock_open.return_value = self.membersJSON
312+
mock_open.return_value = self.members_json
313313

314314
user = rec_lookup.get_details('313233343536373839')
315315
mock_open.assert_called()
316316
self.assertTrue(user['found'])
317317

318318
with patch('modules.rec_lookup.open') as mock_open:
319-
mock_open.return_value = self.membersJSON_alt
319+
mock_open.return_value = self.members_json_alt
320320

321321
user = rec_lookup.get_details('993233343536373839')
322322
mock_open.assert_called()
323323
self.assertFalse(user['found'])
324324

325325
def test_get_group_details(self):
326326
with patch('modules.rec_lookup.open') as mock_open:
327-
mock_open.return_value = self.permissionsJSON
327+
mock_open.return_value = self.permissions_json
328328

329329
group = rec_lookup.get_group_details(1)
330330
mock_open.assert_called()
331331
self.assertTrue(group['found'])
332332

333333
with patch('modules.rec_lookup.open') as mock_open:
334-
mock_open.return_value = self.permissionsJSON_alt
334+
mock_open.return_value = self.permissions_json_alt
335335

336336
group = rec_lookup.get_group_details(69)
337337
mock_open.assert_called()
@@ -340,11 +340,11 @@ def test_get_group_details(self):
340340
def test_access_request_combinations(self):
341341
with patch('modules.rec_lookup.open') as mock_open:
342342
mock_open.side_effect = [
343-
self.systemJSON,
343+
self.system_json,
344344
self.nodes_json, # Opened from conversion function.
345-
self.ownersJSON, # Opened from owner check function.
346-
self.membersJSON, # Opened from get_details function.
347-
self.permissionsJSON, # Opened from get_group_details function.
345+
self.owners_json, # Opened from owner check function.
346+
self.members_json, # Opened from get_details function.
347+
self.permissions_json, # Opened from get_group_details function.
348348
]
349349

350350
self.assertEqual(
@@ -356,4 +356,4 @@ def test_access_request_combinations(self):
356356

357357

358358
if __name__ == '__main__':
359-
unittest.main()
359+
unittest.main()

tests/test_updater.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ def test_get_current_versions(self):
3333
mock_open.assert_called()
3434

3535
if __name__ == '__main__':
36-
unittest.main()
36+
unittest.main()

0 commit comments

Comments
 (0)