-
Notifications
You must be signed in to change notification settings - Fork 238
/
Copy pathtest_example_pizza.py
58 lines (53 loc) · 1.89 KB
/
test_example_pizza.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# -*- coding: utf-8 -*-
import textwrap
from .helpers import create_example_fixture, keys
example_app = create_example_fixture('examples/pizza.py')
def test_pizza(example_app):
example_app.expect(textwrap.dedent("""\
Hi, welcome to Python Pizza
? Is this for delivery? (y/N)"""))
example_app.write('n')
example_app.expect(textwrap.dedent("""\
? Is this for delivery? No
? What's your phone number? """))
example_app.writeline('1111111111')
example_app.expect(textwrap.dedent("""\
? What's your phone number? 1111111111
? What size do you need? (Use arrow keys)
❯ Large
Medium
Small"""))
example_app.write(keys.ENTER)
example_app.expect(textwrap.dedent("""\
? What size do you need? Large
? How many do you need? """))
example_app.writeline('2')
example_app.expect(textwrap.dedent("""\
? How many do you need? 2
? What about the toppings? (pawH)
>> Help, list all options"""))
example_app.writeline('p')
example_app.write(keys.ENTER)
example_app.expect(textwrap.dedent("""\
? What about the toppings? PepperoniCheese
? You also get a free 2L beverage
1) Pepsi
2) 7up
3) Coke
Answer: 1"""))
example_app.write(keys.ENTER)
example_app.expect(textwrap.dedent("""\
? You also get a free 2L beverage Pepsi
? Any comments on your purchase experience? Nope, all good!"""))
example_app.write(keys.ENTER)
example_app.expect(textwrap.dedent("""\
? Any comments on your purchase experience? Nope, all good!
Order receipt:
{'beverage': 'Pepsi',
'comments': 'Nope, all good!',
'phone': '1111111111',
'quantity': 2,
'size': 'large',
'toBeDelivered': False,
'toppings': 'PepperoniCheese'}
"""))