-
Notifications
You must be signed in to change notification settings - Fork 276
/
Copy pathtest_complected.py
44 lines (30 loc) · 1.12 KB
/
test_complected.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
from complected import cats
def test__setup_cats__many_cats(mocker):
random_choice = mocker.patch('random.choice')
random_choice.side_effect = [
# Mock the cat names
"Frazzle", "Dazzle", "Razzle",
# Mock the foods the cats will be fed
"cheese", "cucumber", "papaya"
]
result_cats = cats.setup_cats(3)
assert result_cats[0] == {"name": "Frazzle",
"last_ate": "cheese"}
assert result_cats[1] == {"name": "Dazzle",
"last_ate": "cucumber"}
assert result_cats[2] == {"name": "Razzle",
"last_ate": "papaya"}
def test__setup_cat__one_cat(mocker):
random_choice = mocker.patch('random.choice')
random_choice.side_effect = [
# Mock the cat names
"Frazzle",
# Mock the foods the cats will be fed
"cheese"
]
result_cats = cats.setup_cats(1)
assert result_cats == [{"name": "Frazzle",
"last_ate": "cheese"}]
def test__setup_cat__no_cats(mocker):
result_cats = cats.setup_cats(0)
assert result_cats == []