bots (minor): Simplify test_link_shortener.py further.
* Rename test names to be more descriptive. * Inline messages/response test.
This commit is contained in:
		
							parent
							
								
									e9aa94f81c
								
							
						
					
					
						commit
						d686a3b337
					
				
					 1 changed files with 10 additions and 16 deletions
				
			
		| 
						 | 
				
			
			@ -7,28 +7,22 @@ class TestLinkShortenerBot(StubBotTestCase):
 | 
			
		|||
        with self.mock_config_info({'key': 'qwertyuiop'}):
 | 
			
		||||
            self.verify_reply(message, response)
 | 
			
		||||
 | 
			
		||||
    def test_bot(self) -> None:
 | 
			
		||||
        message = 'Shorten https://www.github.com/zulip/zulip please.'
 | 
			
		||||
        response = 'https://www.github.com/zulip/zulip: https://goo.gl/6uoWKb'
 | 
			
		||||
 | 
			
		||||
    def test_normal(self) -> None:
 | 
			
		||||
        with self.mock_http_conversation('test_normal'):
 | 
			
		||||
            self._test(message, response)
 | 
			
		||||
 | 
			
		||||
    def test_bot_empty(self) -> None:
 | 
			
		||||
        message = 'Shorten nothing please.'
 | 
			
		||||
        response = 'No links found. Send "help" to see usage instructions.'
 | 
			
		||||
            self._test('Shorten https://www.github.com/zulip/zulip please.',
 | 
			
		||||
                       'https://www.github.com/zulip/zulip: https://goo.gl/6uoWKb')
 | 
			
		||||
 | 
			
		||||
    def test_no_links(self) -> None:
 | 
			
		||||
        # No `mock_http_conversation` is necessary because the bot will
 | 
			
		||||
        # recognize that no links are in the message and won't make any HTTP
 | 
			
		||||
        # requests.
 | 
			
		||||
        self._test(message, response)
 | 
			
		||||
 | 
			
		||||
    def test_bot_help(self) -> None:
 | 
			
		||||
        message = 'help'
 | 
			
		||||
        response = ('Mention the link shortener bot in a conversation and then '
 | 
			
		||||
                    'enter any URLs you want to shorten in the body of the message.')
 | 
			
		||||
        self._test('Shorten nothing please.',
 | 
			
		||||
                   'No links found. Send "help" to see usage instructions.')
 | 
			
		||||
 | 
			
		||||
    def test_help(self) -> None:
 | 
			
		||||
        # No `mock_http_conversation` is necessary because the bot will
 | 
			
		||||
        # recognize that the message is 'help' and won't make any HTTP
 | 
			
		||||
        # requests.
 | 
			
		||||
        self._test(message, response)
 | 
			
		||||
        self._test('help',
 | 
			
		||||
                   ('Mention the link shortener bot in a conversation and then '
 | 
			
		||||
                    'enter any URLs you want to shorten in the body of the message.'))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue