Simulator should occasionally throw errors

This lets me test LED blinking code.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
Anna Schumaker 2015-04-22 21:10:19 -04:00
parent da3278d198
commit c877f6db00
1 changed files with 5 additions and 3 deletions

View File

@ -13,10 +13,12 @@ class Request:
pass
def read(self):
if random.randint(0, 1) == 0:
val = random.randint(0, 2)
if val == 0:
return "OK".encode()
return "ERROR".encode()
elif val == 1:
return "ERROR".encode()
raise Exception('Test Exception')
def urlopen(url):