mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +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.
		
			
				
	
	
		
			18 lines
		
	
	
		
			792 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			792 B
		
	
	
	
		
			Python
		
	
	
	
	
	
from zerver.lib.test_classes import WebhookTestCase
 | 
						|
 | 
						|
 | 
						|
class CrashlyticsHookTests(WebhookTestCase):
 | 
						|
    STREAM_NAME = 'crashlytics'
 | 
						|
    URL_TEMPLATE = "/api/v1/external/crashlytics?stream={stream}&api_key={api_key}"
 | 
						|
    FIXTURE_DIR_NAME = 'crashlytics'
 | 
						|
 | 
						|
    def test_crashlytics_verification_message(self) -> None:
 | 
						|
        expected_topic = "Setup"
 | 
						|
        expected_message = "Webhook has been successfully configured."
 | 
						|
        self.check_webhook("verification", expected_topic, expected_message)
 | 
						|
 | 
						|
    def test_crashlytics_build_in_success_status(self) -> None:
 | 
						|
        expected_topic = "123: Issue Title"
 | 
						|
        expected_message = "[Issue](http://crashlytics.com/full/url/to/issue) impacts at least 16 device(s)."
 | 
						|
        self.check_webhook("issue_message", expected_topic, expected_message)
 |