Added test scrpt and a mockup of zenity
This commit is contained in:
		
							
								
								
									
										23
									
								
								test/mock/zenity
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										23
									
								
								test/mock/zenity
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
# fake-zenity: script that mocks the behavior of zenity based on the ./.fake-zenity-response file
 | 
			
		||||
 | 
			
		||||
if [[ $1 == "--set-fake-response" ]]; then
 | 
			
		||||
  #someone knows we are fake :)
 | 
			
		||||
  echo $2 >~/.fake_zenity_response
 | 
			
		||||
else
 | 
			
		||||
  if [ -f ~/.fake_zenity_response ]; then
 | 
			
		||||
    FAKE_ZENITY_RESPONSE=$(cat ~/.fake_zenity_response)
 | 
			
		||||
 | 
			
		||||
    if [[ $FAKE_ZENITY_RESPONSE == "yes_tmp" ]]; then
 | 
			
		||||
      printf "Allow this time\n"
 | 
			
		||||
      exit 1
 | 
			
		||||
    elif [[ $FAKE_ZENITY_RESPONSE == "no" ]]; then
 | 
			
		||||
      exit 1
 | 
			
		||||
    elif [[ $FAKE_ZENITY_RESPONSE == "yes" ]]; then
 | 
			
		||||
      exit 0
 | 
			
		||||
    fi
 | 
			
		||||
  fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
exit -1 # TODO: call actual zenity here
 | 
			
		||||
		Reference in New Issue
	
	Block a user