Exemplo n.º 1
0
    def setUp(self):
        self.last_saved_state = None

        self.orders = {"Emi": [10.00], "Ivo": [5.00, 20.00]}

        self.orders2 = {"Jane": [15.00, 0.50], "Jack": [5.00]}

        expected = ["Emi - 10.00", "Ivo - 25.00"]

        self.expected_string = "\n".join(expected)

        timest = datetime.fromtimestamp(time()).strftime("%Y_%m_%d_%H_%M_%S")
        self.filename = "orders_" + timest

        time2 = time() + 60
        timest2 = datetime.fromtimestamp(time2).strftime("%Y_%m_%d_%H_%M_%S")
        self.filename2 = "orders_" + timest2

        self.assertTrue("Saved the current order to {}.".format(timest), pizza.save(self.orders, self.last_saved_state))

        pizza.save(self.orders2, self.last_saved_state, time2)

        self.file = open(self.filename, "r")
        self.file2 = open(self.filename2, "r")
Exemplo n.º 2
0
    def test_save_works_without_orders(self):
        message = "There are no orders to save."

        self.assertTrue(message, pizza.save({}, self.last_saved_state))