add unit test for new endpoint
This commit is contained in:
parent
f8a04450cb
commit
cdd1086006
|
@ -6,4 +6,5 @@ TEST_SESSION_ID_1 = 'test_session_id_1'
|
|||
TEST_TOKEN_0 = 'test_token_0'
|
||||
TEST_TOKEN_1 = 'test_token_1'
|
||||
TEST_CLOSED_GROUP_ID = 'test_closed_group_id'
|
||||
TEST_CLOSED_GROUP_ID_2 = 'test_closed_group_id_2'
|
||||
TEST_DATA = 'test_data_bla_bla...'
|
||||
|
|
|
@ -9,7 +9,8 @@ tests_cases = ['lsrpc',
|
|||
'notify',
|
||||
'unregister',
|
||||
'subscribe_closed_group',
|
||||
'unsubscribe_closed_group']
|
||||
'unsubscribe_closed_group',
|
||||
'register_legacy_groups_only']
|
||||
|
||||
|
||||
class ServerTests(unittest.TestCase):
|
||||
|
@ -71,6 +72,16 @@ class ServerTests(unittest.TestCase):
|
|||
test_closed_group_in_cache = self.database_helper.closed_group_cache.get(TEST_CLOSED_GROUP_ID)
|
||||
self.assertFalse(TEST_SESSION_ID in test_closed_group_in_cache.members)
|
||||
|
||||
def test_7_register_legacy_groups_only(self):
|
||||
args = {HTTP.RegistrationRequest.TOKEN: TEST_TOKEN_0,
|
||||
HTTP.RegistrationRequest.PUBKEY: TEST_SESSION_ID,
|
||||
HTTP.RegistrationRequest.DEVICE_TYPE: TEST_DEVICE_TYPE,
|
||||
HTTP.SubscriptionRequest.CLOSED_GROUPS: f'[{TEST_CLOSED_GROUP_ID}, {TEST_CLOSED_GROUP_ID_2}]'}
|
||||
register_legacy_groups_only(args)
|
||||
self.assertEqual(len(self.database_helper.closed_group_cache), 2)
|
||||
test_device_in_cache = self.database_helper.device_cache.get(TEST_SESSION_ID)
|
||||
self.assertTrue(test_device_in_cache.legacy_groups_only)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue