mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-30 11:33:51 +00:00 
			
		
		
		
	upload: Stop requiring callers pass in the file size.
This can be calculated because we have the contents.
This commit is contained in:
		
				
					committed by
					
						 Tim Abbott
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							58a9fe9af1
						
					
				
				
					commit
					f52a93bc14
				
			| @@ -1836,14 +1836,14 @@ class UploadSpaceTests(UploadSerializeMixin, ZulipTestCase): | ||||
|         self.assertEqual(0, cache_get(get_realm_used_upload_space_cache_key(self.realm.id))[0]) | ||||
|  | ||||
|         data = b"zulip!" | ||||
|         upload_message_attachment("dummy.txt", len(data), "text/plain", data, self.user_profile) | ||||
|         upload_message_attachment("dummy.txt", "text/plain", data, self.user_profile) | ||||
|         # notify_attachment_update function calls currently_used_upload_space_bytes which | ||||
|         # updates the cache. | ||||
|         self.assert_length(data, cache_get(get_realm_used_upload_space_cache_key(self.realm.id))[0]) | ||||
|         self.assert_length(data, self.realm.currently_used_upload_space_bytes()) | ||||
|  | ||||
|         data2 = b"more-data!" | ||||
|         upload_message_attachment("dummy2.txt", len(data2), "text/plain", data2, self.user_profile) | ||||
|         upload_message_attachment("dummy2.txt", "text/plain", data2, self.user_profile) | ||||
|         self.assertEqual( | ||||
|             len(data) + len(data2), | ||||
|             cache_get(get_realm_used_upload_space_cache_key(self.realm.id))[0], | ||||
| @@ -1876,7 +1876,7 @@ class UploadSpaceTests(UploadSerializeMixin, ZulipTestCase): | ||||
|         self.assert_length(data2, self.realm.currently_used_upload_space_bytes()) | ||||
|  | ||||
|         data3 = b"even-more-data!" | ||||
|         upload_message_attachment("dummy3.txt", len(data3), "text/plain", data3, self.user_profile) | ||||
|         upload_message_attachment("dummy3.txt", "text/plain", data3, self.user_profile) | ||||
|         self.assertEqual(len(data2) + len(data3), self.realm.currently_used_upload_space_bytes()) | ||||
|  | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user