-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
49 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import pytest | ||
from unittest.mock import MagicMock | ||
from CartePizzeria import CartePizzeria | ||
from CartePizzeriaException import CartePizzeriaException | ||
|
||
def test_is_empty(): | ||
carte_pizza=CartePizzeria() | ||
assert carte_pizza.is_empty()==True | ||
|
||
pizza_mock=MagicMock() | ||
carte_pizza.add_pizza(pizza_mock) | ||
assert carte_pizza.is_empty()==False | ||
|
||
def test_nb_pizzas(): | ||
carte_pizza=CartePizzeria() | ||
assert carte_pizza.nb_pizzas()==0 | ||
|
||
marguarita=MagicMock() | ||
campionne=MagicMock() | ||
carte_pizza.add_pizza(marguarita) | ||
carte_pizza.add_pizza(campionne) | ||
assert carte_pizza.nb_pizzas()==2 | ||
|
||
def test_add_pizza(): | ||
carte_pizza=CartePizzeria() | ||
campionne=MagicMock() | ||
carte_pizza.add_pizza(campionne) | ||
assert carte_pizza.nb_pizzas()==1 | ||
|
||
def test_remove_pizza(): | ||
carte_pizza=CartePizzeria() | ||
pizza_mock_1=MagicMock() | ||
pizza_mock_1.name="vegetarienne" | ||
pizza_mock_2=MagicMock() | ||
pizza_mock_2.name="marguarita" | ||
carte_pizza.add_pizza(pizza_mock_1) | ||
carte_pizza.add_pizza(pizza_mock_2) | ||
|
||
carte_pizza.remove_pizza("vegetarienne") | ||
assert carte_pizza.nb_pizzas()==1 | ||
|
||
with pytest.raises(CartePizzeriaException): | ||
carte_pizza.remove_pizza("Hawaiiane") |