mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-30 22:54:14 +00:00 
			
		
		
		
	#N/A Add heroku_not_command rule
				
					
				
			This commit is contained in:
		
							
								
								
									
										34
									
								
								tests/rules/test_heroku_not_command.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								tests/rules/test_heroku_not_command.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| import pytest | ||||
| from tests.utils import Command | ||||
| from thefuck.rules.heroku_not_command import match, get_new_command | ||||
|  | ||||
|  | ||||
| def suggest_stderr(cmd): | ||||
|     return ''' !    `{}` is not a heroku command. | ||||
|      !    Perhaps you meant `logs`, `pg`. | ||||
|      !    See `heroku help` for a list of available commands.'''.format(cmd) | ||||
|  | ||||
|  | ||||
| no_suggest_stderr = ''' !    `aaaaa` is not a heroku command. | ||||
|  !    See `heroku help` for a list of available commands.''' | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize('cmd', ['log', 'pge']) | ||||
| def test_match(cmd): | ||||
|     assert match( | ||||
|         Command('heroku {}'.format(cmd), stderr=suggest_stderr(cmd)), None) | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize('script, stderr', [ | ||||
|     ('cat log', suggest_stderr('log')), | ||||
|     ('heroku aaa', no_suggest_stderr)]) | ||||
| def test_not_match(script, stderr): | ||||
|     assert not match(Command(script, stderr=stderr), None) | ||||
|  | ||||
|  | ||||
| @pytest.mark.parametrize('cmd, result', [ | ||||
|     ('log', 'heroku logs'), | ||||
|     ('pge', 'heroku pg')]) | ||||
| def test_get_new_command(cmd, result): | ||||
|     command = Command('heroku {}'.format(cmd), stderr=suggest_stderr(cmd)) | ||||
|     assert get_new_command(command, None) == result | ||||
		Reference in New Issue
	
	Block a user