mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 12:03:46 +00:00 
			
		
		
		
	Almost all webhook tests use this helper, except a few webhooks that write to private streams. Being concise is important here, and the name `self.send_and_test_stream_message` always confused me, since it sounds you're sending a stream message, and it leaves out the webhook piece. We should consider renaming `send_and_test_private_message` to something like `check_webhook_private`, but I couldn't decide on a great name, and it's very rarely used. So for now I just made sure the docstrings of the two sibling functions reference each other.
		
			
				
	
	
		
			13 lines
		
	
	
		
			604 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
		
			604 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from zerver.lib.test_classes import WebhookTestCase
 | |
| 
 | |
| 
 | |
| class ErrBitHookTests(WebhookTestCase):
 | |
|     STREAM_NAME = 'errbit'
 | |
|     URL_TEMPLATE = "/api/v1/external/errbit?stream={stream}&api_key={api_key}"
 | |
|     FIXTURE_DIR_NAME = 'errbit'
 | |
| 
 | |
|     def test_errbit_error_message(self) -> None:
 | |
|         expected_topic = "ZulipIntegrationTest / ErrbitEnvName"
 | |
|         expected_message = "[IllegalStateException](https://errbit.example.com/apps/5e1ed1ff1a603f3916f4f0de/problems/5e1fe93e1a603f3916f4f0e3): \"Invalid state error\" occurred."
 | |
|         self.check_webhook("error_message", expected_topic, expected_message)
 |