mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	users: Improve testing for user_ids_to_users.
This commit is contained in:
		@@ -109,7 +109,7 @@ def user_ids_to_users(user_ids: List[int], realm: Realm) -> List[UserProfile]:
 | 
			
		||||
    # users should be included.
 | 
			
		||||
 | 
			
		||||
    def fetch_users_by_id(user_ids: List[int]) -> List[UserProfile]:
 | 
			
		||||
        if not user_ids:
 | 
			
		||||
        if len(user_ids) == 0:
 | 
			
		||||
            return []
 | 
			
		||||
 | 
			
		||||
        return list(UserProfile.objects.filter(id__in=user_ids).select_related())
 | 
			
		||||
 
 | 
			
		||||
@@ -286,7 +286,9 @@ class UserProfileTest(ZulipTestCase):
 | 
			
		||||
            self.example_user('cordelia').id,
 | 
			
		||||
        ]
 | 
			
		||||
 | 
			
		||||
        user_ids_to_users(real_user_ids, get_realm("zulip"))
 | 
			
		||||
        self.assertEqual(user_ids_to_users([], get_realm("zulip")), [])
 | 
			
		||||
        self.assertEqual(set([user_profile.id for user_profile in user_ids_to_users(real_user_ids, get_realm("zulip"))]),
 | 
			
		||||
                         set(real_user_ids))
 | 
			
		||||
        with self.assertRaises(JsonableError):
 | 
			
		||||
            user_ids_to_users([1234], get_realm("zephyr"))
 | 
			
		||||
        with self.assertRaises(JsonableError):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user