default-hour #14
					 2 changed files with 19 additions and 4 deletions
				
			
		| 
						 | 
					@ -15,10 +15,13 @@ app.url_map.strict_slashes = False
 | 
				
			||||||
@app.route('/<int(min=0, max=23):hours>/<int(min=0, max=59):minutes>')
 | 
					@app.route('/<int(min=0, max=23):hours>/<int(min=0, max=59):minutes>')
 | 
				
			||||||
def index(hours=None, minutes=None):
 | 
					def index(hours=None, minutes=None):
 | 
				
			||||||
    """ main and only app """
 | 
					    """ main and only app """
 | 
				
			||||||
    if not hours:
 | 
					
 | 
				
			||||||
 | 
					    if hours:
 | 
				
			||||||
 | 
					        if not minutes:
 | 
				
			||||||
 | 
					            minutes = 0
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
        hours = 17
 | 
					        hours = 17
 | 
				
			||||||
    if not minutes:
 | 
					        minutes = 30
 | 
				
			||||||
        minutes = 0
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    data = render_template('beer.html', hours=hours, minutes=minutes)
 | 
					    data = render_template('beer.html', hours=hours, minutes=minutes)
 | 
				
			||||||
    return data
 | 
					    return data
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5,9 +5,21 @@ else
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
echo "testing URL: ${TEST_URL}"
 | 
					echo "testing URL: ${TEST_URL}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					while :
 | 
				
			||||||
 | 
					do
 | 
				
			||||||
 | 
						status_code=$(curl -o /dev/null -s -w '%{http_code}' ${TEST_URL})
 | 
				
			||||||
 | 
						echo "status code: ${status_code}"
 | 
				
			||||||
 | 
						[[ ${status_code} -eq 200 ]] && break
 | 
				
			||||||
 | 
						[[ ${i} -gt 5 ]] && exit 1
 | 
				
			||||||
 | 
						echo "service not ready or in error"
 | 
				
			||||||
 | 
						sleep 5
 | 
				
			||||||
 | 
						i=$(( i+1 ))
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CURL_OPTS='-s'
 | 
					CURL_OPTS='-s'
 | 
				
			||||||
# default
 | 
					# default
 | 
				
			||||||
curl ${CURL_OPTS} ${TEST_URL} | grep -q 'setHours( 17, 0);'
 | 
					curl ${CURL_OPTS} ${TEST_URL} | grep -q 'setHours( 17, 30);'
 | 
				
			||||||
[ $? -ne 0 ] && echo "Failed with default" && exit 1
 | 
					[ $? -ne 0 ] && echo "Failed with default" && exit 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# set 1 parameter
 | 
					# set 1 parameter
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue