def test_get_user_sessions_wrong_group(self): """ Negative test - Confirm we cannot get sessions for another user not in the other group """ response = sessions.get_user_sessions( environment.ATHERA_API_TEST_BASE_URL, environment.ATHERA_API_TEST_OTHER_GROUP_ID, self.token, environment.ATHERA_API_TEST_OTHER_USER_ID, ) self.assertEqual(response.status_code, codes.forbidden)
def test_get_user_sessions_bad_group(self): """ Negative test - Double check we can't fool the group membership check with an odd group """ response = sessions.get_user_sessions( environment.ATHERA_API_TEST_BASE_URL, "wensleydale", self.token, environment.ATHERA_API_TEST_OTHER_USER_ID, ) self.assertEqual(response.status_code, codes.internal_server_error)
def test_get_user_sessions(self): """ Positive test """ response = sessions.get_user_sessions( environment.ATHERA_API_TEST_BASE_URL, environment.ATHERA_API_TEST_GROUP_ID, self.token, environment.ATHERA_API_TEST_USER_ID, ) self.assertEqual(response.status_code, codes.ok) data = response.json() session_data = data['sessions'] self.assertNotEqual(len(session_data), 0) first_session = session_data[0] self.assertNotEqual(len(first_session), 0) self.assertIn("id", first_session)