-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
34 lines (28 loc) · 865 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import unittest
from unittest import mock
import sys
mock.patch.dict('sys.modules', RPi=mock.MagicMock()).start()
class TestDrinkomatic(unittest.TestCase):
@mock.patch('RPi.GPIO')
def test_threading(self, mock_gpio):
from drinkomatic import Drinkomatic
VODKA_RELAY_PIN = 16
JUICE_RELAY_PIN = 18
BUZZER_PIN = 37
dear_assistant = Drinkomatic(VODKA_RELAY_PIN, JUICE_RELAY_PIN, BUZZER_PIN)
vodka_recipe = {
0: 20
}
drink_recipe = {
0: 20,
1: 80
}
try:
print('Preparing vodka...')
dear_assistant.prepare_drink(vodka_recipe)
print('Preparing.drink...')
dear_assistant.prepare_drink(drink_recipe)
finally:
dear_assistant.stop()
if __name__ == '__main__':
unittest.main()