Exemple #1
0
 def varasto_hae_tuote(tuote_id):
     if tuote_id == 1:
         return Tuote(1, "maito", 5)
     elif tuote_id == 2:
         return Tuote(2, "Voi", 3)
     elif tuote_id == 3:
         return Tuote(3, "Keksi", 8)
Exemple #2
0
 def varasto_hae_tuote(tuote_id):
     if tuote_id == 1:
         return Tuote(1, "maito", 5)
     if tuote_id == 2:
         return Tuote(2, "piima", 10)
     if tuote_id == 3:
         return Tuote(3, "olut", 100)
Exemple #3
0
 def varasto_hae_tuote(tuote_id):
     if tuote_id == 1:
         return Tuote(1, "maito", 5)
     if tuote_id == 2:
         return Tuote(2, "jauheliha", 10)
     if tuote_id == 3:
         return Tuote(3, "porkkana", 3)
Exemple #4
0
 def varasto_hae_tuote(tuote_id):
     if tuote_id == 1:
         return Tuote(1, "maito", 5)
     if tuote_id == 2:
         return Tuote(2, "kalja", 10)
     if tuote_id == 3:
         return Tuote(3, "leipä", 3)
Exemple #5
0
    def setUp(self):
        self.pankki_mock = Mock()
        self.varasto_mock = Mock()
        self.viitegeneraattori_mock = Mock()
        self.kauppa = Kauppa(self.varasto_mock, self.pankki_mock,
                             self.viitegeneraattori_mock)
        self.viitegeneraattori_mock.uusi.side_effect = [42, 43, 44]

        tuotteet = {
            1: (Tuote(1, "maito", 5), 10),
            2: (Tuote(2, "liha", 10), 20),
            3: (Tuote(3, "tofu", 10), 0)
        }

        def varasto_saldo(tuote_id):
            return tuotteet[tuote_id][1]

        def varasto_hae_tuote(tuote_id):
            return tuotteet[tuote_id][0]

        self.varasto_mock.saldo.side_effect = varasto_saldo
        self.varasto_mock.hae_tuote.side_effect = varasto_hae_tuote

        self.kauppa = Kauppa(self.varasto_mock, self.pankki_mock,
                             self.viitegeneraattori_mock)
Exemple #6
0
 def muokkaaTuote(self, vanhanimi, uusinimi, uusihinta, uusimaara):
     index = 0
     for tuote in self.tuotteet:
         if (tuote.haeNimi() == vanhanimi):
             tuote = Tuote(uusinimi, uusihinta, uusimaara)
             self.tuotteet[index] = tuote
         index = index + 1
Exemple #7
0
 def _alusta_tuotteet(self):
     self._saldot[Tuote(1, "Koff Portteri", 3)] = 100
     self._saldot[Tuote(2, "Fink Bräu I", 1)] = 25
     self._saldot[Tuote(3, "Sierra Nevada Pale Ale", 5)] = 30
     self._saldot[Tuote(4, "Mikkeller not just another Wit", 7)] = 40
     self._saldot[Tuote(5, "Weihenstephaner Hefeweisse", 4)] = 15
Exemple #8
0
 def lisaaTuote(self, nimi, hinta, maara):
     tuote = Tuote(nimi, hinta, maara)
     self.tuotteet.append(tuote)
 def varasto_hae_tuote(tuote_id):
     if tuote_id == 1:
         return Tuote(1, "maito", 5)
     if tuote_id == 2:
         return Tuote(2, "lihis", 5)
 def varasto_hae_tuote(tuote_id):
     if tuote_id == 1:
         return Tuote(1, "maito", 5)
Exemple #11
0
 def varasto_hae_tuote(tuote_id):
     if tuote_id == 1:
         return Tuote(1, "maito", 5)
     if tuote_id == 2:
         return Tuote(2, "piimä", 6)