test
This commit is contained in:
parent
40b5f10822
commit
da6d0b5bea
@ -267,9 +267,11 @@ class Borne:
|
|||||||
|
|
||||||
## Gestion du payeent
|
## Gestion du payeent
|
||||||
def payer(self):
|
def payer(self):
|
||||||
|
self.nonVoiture()
|
||||||
|
self.__ui.btn_quitter.setDisabled(False)
|
||||||
|
self.__ui.btn_Voiture.setDisabled(False)
|
||||||
self.ticketRetrait(self.__placementAPayer, Service.getAllServicePlacement(self.__placementAPayer))
|
self.ticketRetrait(self.__placementAPayer, Service.getAllServicePlacement(self.__placementAPayer))
|
||||||
self.__main.activity(self.__nomBorne + " : Recuperation Anonyme : " + str(self.__placementAPayer), self.__main.lvl.INFO)
|
self.__main.activity(self.__nomBorne + " : Recuperation Anonyme : " + str(self.__placementAPayer), self.__main.lvl.INFO)
|
||||||
self.nonVoiture()
|
|
||||||
|
|
||||||
## generation ticket depot
|
## generation ticket depot
|
||||||
def ticketDepot(self, id):
|
def ticketDepot(self, id):
|
||||||
|
@ -99,13 +99,15 @@ class DetailsPlaces(CreaParking):
|
|||||||
super(DetailsPlaces, self).__init__(main)
|
super(DetailsPlaces, self).__init__(main)
|
||||||
|
|
||||||
self._ui.lineEdit_nom.setText(parking.nom)
|
self._ui.lineEdit_nom.setText(parking.nom)
|
||||||
for p in parking.typePlaces :
|
for p in parking.listeTypePlace :
|
||||||
row = self._ui.tableWidget.rowCount() - 1
|
row = self._ui.tableWidget.rowCount() - 1
|
||||||
if row != 0:
|
if row != 0:
|
||||||
self._ui.tableWidget.insertRow(row)
|
self._ui.tableWidget.insertRow(row)
|
||||||
self._ui.tableWidget.setItem(row, 0, QTableWidgetItem(str(p.hauteur)))
|
self._ui.tableWidget.setItem(row, 0, QTableWidgetItem(str(p.hauteur)))
|
||||||
self._ui.tableWidget.setItem(row, 1, QTableWidgetItem(str(p.longueur)))
|
self._ui.tableWidget.setItem(row, 1, QTableWidgetItem(str(p.longueur)))
|
||||||
self._ui.tableWidget.setItem(row, 2, QTableWidgetItem(str(p.nb)))
|
self._ui.tableWidget.setItem(row, 2, QTableWidgetItem(str(p.nombre)))
|
||||||
|
self._ui.tableWidget.setItem(row, 3, QTableWidgetItem(str(p.niveau)))
|
||||||
|
self._ui.tableWidget.setItem(row, 4, QTableWidgetItem(str(p.prix)))
|
||||||
|
|
||||||
self._ui.lineEdit_nom.setDisabled(True)
|
self._ui.lineEdit_nom.setDisabled(True)
|
||||||
self._ui.tableWidget.setDisabled(True)
|
self._ui.tableWidget.setDisabled(True)
|
||||||
|
@ -6,8 +6,8 @@ import sqlite3
|
|||||||
|
|
||||||
## Classe de connexion a la bd
|
## Classe de connexion a la bd
|
||||||
class connexionBDD:
|
class connexionBDD:
|
||||||
__chemin = "m/BDDprojetPython.sq3"
|
__chemin = "src/m/BDDprojetPython.sq3"
|
||||||
__sql = "m/table.sql"
|
__sql = "src/m/table.sql"
|
||||||
|
|
||||||
## Construeur de la connexion. Initialise la bd en cas d'inexistance
|
## Construeur de la connexion. Initialise la bd en cas d'inexistance
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -101,6 +101,18 @@ class Parking:
|
|||||||
def nbSuperAbo(self):
|
def nbSuperAbo(self):
|
||||||
return Place.nbSuperAbo(self.__id)
|
return Place.nbSuperAbo(self.__id)
|
||||||
|
|
||||||
|
## propriete : listeTypePlace
|
||||||
|
@property
|
||||||
|
def listeTypePlace(self):
|
||||||
|
c = connexionBDD()
|
||||||
|
r = c.execute("SELECT idTypePlace FROM typePlace WHERE idTypePlace in (SELECT idTypePlace FROM place WHERE idParking = '" + str(self.__id) + "')")
|
||||||
|
rows = r.fetchall()
|
||||||
|
c.seDeconnecter()
|
||||||
|
l = []
|
||||||
|
for row in rows:
|
||||||
|
l.append(TypePlace(row["idTypePlace"]))
|
||||||
|
return l
|
||||||
|
|
||||||
## Recherche une place pour une voiture
|
## Recherche une place pour une voiture
|
||||||
# @param voiture voiture pour laquel on recherche la place
|
# @param voiture voiture pour laquel on recherche la place
|
||||||
# @return Place Si touvé : Place sinon : None
|
# @return Place Si touvé : Place sinon : None
|
||||||
|
@ -21,7 +21,6 @@ class Service:
|
|||||||
l = []
|
l = []
|
||||||
for row in rows:
|
for row in rows:
|
||||||
l.append(Service(row["idService"]))
|
l.append(Service(row["idService"]))
|
||||||
print("l = " + str(l))
|
|
||||||
return l
|
return l
|
||||||
|
|
||||||
## Retourne tout les services associé a un Placement
|
## Retourne tout les services associé a un Placement
|
||||||
|
@ -12,8 +12,8 @@ class TestParking:
|
|||||||
def TestParking(self):
|
def TestParking(self):
|
||||||
p = Parking(None, "test", [TypePlace(None, 220, 200, 4, 2.5, 1), TypePlace(None, 200, 130, 5, 2.5, 1)])
|
p = Parking(None, "test", [TypePlace(None, 220, 200, 4, 2.5, 1), TypePlace(None, 200, 130, 5, 2.5, 1)])
|
||||||
id = p.id
|
id = p.id
|
||||||
assert_equal(p.nbPlacesLibresParking, 9, "Nombre de place libre non valide")
|
assert_equal(p.nbPlacesLibresParking, 13, "Nombre de place libre non valide")
|
||||||
assert_equal(p.nbPlaces, 9, "Nombre de place non valide")
|
assert_equal(p.nbPlaces, 13, "Nombre de place non valide")
|
||||||
assert_equal(p.nbSuperAbo, 0, "Nombre de place super abo")
|
assert_equal(p.nbSuperAbo, 0, "Nombre de place super abo")
|
||||||
|
|
||||||
def TestRecherchePlace(self):
|
def TestRecherchePlace(self):
|
||||||
@ -23,17 +23,20 @@ class TestParking:
|
|||||||
place = p.recherchePlace(v)
|
place = p.recherchePlace(v)
|
||||||
assert_equal(place, None, "Aucune place devrait etre trouve")
|
assert_equal(place, None, "Aucune place devrait etre trouve")
|
||||||
|
|
||||||
|
p = Parking(None, "test", [TypePlace(None, 220, 200, 4, 2.5, 1)])
|
||||||
v = Voiture(None,None,100,300)
|
v = Voiture(None,None,100,300)
|
||||||
place = p.recherchePlace(v)
|
place = p.recherchePlace(v)
|
||||||
assert_equal(place, None, "Aucune place devrait etre trouve")
|
assert_equal(place, None, "Aucune place devrait etre trouve")
|
||||||
|
|
||||||
|
p = Parking(None, "test", [TypePlace(None, 220, 200, 4, 2.5, 1)])
|
||||||
v = Voiture(None,None,300,100)
|
v = Voiture(None,None,300,100)
|
||||||
place = p.recherchePlace(v)
|
place = p.recherchePlace(v)
|
||||||
assert_equal(place, None, "Aucune place devrait estre trouve")
|
assert_equal(place, None, "Aucune place devrait estre trouve")
|
||||||
|
|
||||||
v = Voiture(None,None,100,100)
|
p = Parking(None, "test", [TypePlace(None, 220, 200, 4, 2.5, 1)])
|
||||||
|
v = Voiture(None,None,10,10,"lol")
|
||||||
place = p.recherchePlace(v)
|
place = p.recherchePlace(v)
|
||||||
assert_not_equal(place, None, "Une place devrait etre trouve")
|
assert_not_equal(place is None, False, "Une place devrait etre trouve")
|
||||||
|
|
||||||
## Test Place
|
## Test Place
|
||||||
class TestPlace:
|
class TestPlace:
|
||||||
|
@ -1,15 +1,49 @@
|
|||||||
"""
|
"""
|
||||||
Test Module m/Service
|
Test Module m/Service
|
||||||
"""
|
"""
|
||||||
|
import datetime
|
||||||
|
from nose.tools import assert_equal,assert_not_equal
|
||||||
from src.m.Abonnement import Client, TypeAbonnement
|
from src.m.Abonnement import Client, TypeAbonnement
|
||||||
from src.m.Parking import Placement
|
from src.m.Parking import Placement, Place, Parking, TypePlace
|
||||||
|
|
||||||
from src.m.Service import Service, TypeService
|
from src.m.Service import Service, TypeService
|
||||||
|
from src.m.Voiture import Voiture
|
||||||
|
|
||||||
## Test des Service
|
## Test des Service
|
||||||
class TestService:
|
class TestService:
|
||||||
## Test instanciation
|
## Test instanciation
|
||||||
def TestService(self):
|
def TestService(self):
|
||||||
pass
|
v = Voiture(None, None, 120, 100, "IMMA")
|
||||||
#c = Client(None,"Jean","Paul","1225233",TypeAbonnement.ABONNE)
|
t = TypePlace(None, 220, 200, 4, 2.5, 1)
|
||||||
#Service(None,c ,Placement(),TypeService.ENTRETIEN)
|
place = Place(None,Parking(None, "test", [t]),t,2)
|
||||||
|
placemnent = Placement(None,v,place)
|
||||||
|
c = Client(None,"Jean","Paul","1225233",TypeAbonnement.ABONNE)
|
||||||
|
s = Service(None, c, placemnent, TypeService.ENTRETIEN)
|
||||||
|
assert_equal(s.estRealise, False)
|
||||||
|
assert_equal(s.typeService, TypeService.ENTRETIEN)
|
||||||
|
assert_equal(s.placement,placemnent)
|
||||||
|
|
||||||
|
def TestModifService(self):
|
||||||
|
v = Voiture(None, None, 120, 100, "IMMA")
|
||||||
|
t = TypePlace(None, 220, 200, 4, 2.5, 1)
|
||||||
|
place = Place(None,Parking(None, "test", [t]),t,2)
|
||||||
|
placemnent = Placement(None,v,place)
|
||||||
|
c = Client(None,"Jean","Paul","1225233",TypeAbonnement.ABONNE)
|
||||||
|
s = Service(None, c, placemnent, TypeService.LIVRAISON, datetime.time(),"Miraol")
|
||||||
|
|
||||||
|
time = datetime.time()
|
||||||
|
s.maj(time,"autre")
|
||||||
|
assert_equal(s.lieu,"autre")
|
||||||
|
assert_equal(s.dateService,time)
|
||||||
|
|
||||||
|
def TestDoService(self):
|
||||||
|
v = Voiture(None, None, 120, 100, "IMMA")
|
||||||
|
t = TypePlace(None, 220, 200, 4, 2.5, 1)
|
||||||
|
place = Place(None,Parking(None, "test", [t]),t,2)
|
||||||
|
placemnent = Placement(None,v,place)
|
||||||
|
c = Client(None,"Jean","Paul","1225233",TypeAbonnement.ABONNE)
|
||||||
|
s = Service(None, c, placemnent, TypeService.LIVRAISON, datetime.time(),"Miraol")
|
||||||
|
assert_equal(s.estRealise, False)
|
||||||
|
s.doService()
|
||||||
|
assert_equal(s.estRealise, True)
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user