def get(self): try: service = session.query(ServiceTable, Client, Product).join( Client, Product).filter(ServiceTable.id == 1).first() if service is None: return None else: c = ClientClass(service.Client.name, service.Client.cpf, service.Client.segment) c.id = service.Client.id p = ProductClass(service.Product.name, service.Product.description, service.Product.image) p.id = service.Product.id s = ServiceClass(service.Service.request_date, service.Service.cancel_date) s.id = service.Service.id s.client = c s.product = p return s except Exception as e: print "Deu erro: " % e
def get(self): try: service = session.query( ServiceModel,Client,Product)\ .join(Client,Product)\ .filter(ServiceModel.id==self.service.id).first() if service is None: return None c = ClientClass(service.Client.name, service.Client.cpf, service.Client.segment) c.id = service.Client.id p = ProductClass(service.Product.name, service.Product.description, service.Product.image) p.id = service.Product.id s = ServiceClass(service.Service.request_date,service.Service.cancel_date) s.id = service.Service.id s.client = c s.product = p return s except Exception as e: print "Algum erro aconteceu: %s"%e
def test_clients_who_have_hops_larger_than_umax_shall_not_stay_on_server(conf): server1 = Server(conf['UMAX'], conf['TTASK']) client1 = Client() for i in range(0, conf['UMAX'] + 5): client1.increase_hop() server1.add_client(client1) server1.update_server_status() assert 0 == server1.get_current_number_of_clients()
def test_remove_client_from_server(conf): server1 = Server(conf['UMAX'], conf['TTASK']) client1 = Client() client_hash_code = client1.get_hash_code() server1.add_client(client1) assert str == type(client_hash_code), "The hash code must be a string" # before removing, the server length should be 1 assert 1 == server1.get_current_number_of_clients() server1._remove_client_from_server_using_hash_code(client_hash_code) # now the server should not have any clients assert 0 == server1.get_current_number_of_clients()
def setup_all(self): player = Player() self.setup_player(player) map_game = Board() self.map_game = map_game client = Client() self.client = client
def test_server_add_client(conf): server1 = Server(conf['UMAX'], conf['TTASK']) client1 = Client() server1.add_client(client1) assert 1 == len(server1.clients), "There was an error an adding the client" assert 1 == server1.get_current_number_of_clients( ), "There was an error an counting the number of clients"
def switch(x): cli = Client() prod = Product() serv = Service() dict_options = { 1: cli.add_client, 2: prod.add_product, 3: serv.add_service } dict_options[x]()
def click_to_list(self): client = Client(name_of_client, second_name_of_client, age_of_client, type_of_visit) officer = ShootingOfficer(name_of_officer, second_name_of_officer, age_of_officer, work_exp, work_ckd) wepon = Wepons(mark, calibr, ammo) list_of_upgrades = List_of_upgrades(scope, handel, mag, type_of_mag, type_of_bulets) cur_wepon = Cur_wepon(wepon, list_of_upgrades) action = Action(status) self.ui.stackedWidget.setCurrentIndex(0)
def get(self): try: service = session.query(ServiceTable,Client,Product).join(Client,Product).filter(ServiceTable.id==self._service._id).first() if service is None: return None else: c = ClientClass(service.Client.name,service.Client.cpf,service.Client.segment) c._id = service.Client.id p = ProductClass(service.Product.name,service.Product.description,service.Product.image) p._id = service.Product.id s = ServiceClass(service.Service.request_date,service.Service.cancel_date) s._id = service.Service.id s._client = c s._product = p return s except Exception as e: print "Deu erro: ",e
def get(self): try: service = ( session.query(ServiceModel, Client, Product) .join(Client, Product) .filter(ServiceModel.id == self.service.id) .first() ) if service is None: return None c = ClientClass(service.Client.name, service.Client.cpf, service.Client.segment) c.id = service.Client.id p = ProductClass(service.Product.name, service.Product.description, service.Product.image) p.id = service.Product.id s = ServiceClass(service.Service.request_date, service.Service.cancel_date) s.id = service.Service.id s.client = c s.product = p return s except Exception as e: print "Algum erro aconteceu: %s" % e
def test_client_constructor(conf): client1 = Client() assert 1 == client1.get_current_hop() assert type(client1.get_hash_code()) == str
from Classes.Wepons import Wepons from Classes.ShootingOfficer import ShootingOfficer from Classes.List_of_upgrades import List_of_upgrades from Classes.Action import Action from Classes.Cur_wepon import Cur_wepon from Classes.OfficerClientWepon import OfficerClientWepon from Classes.Database import db from pony.orm import * db.bind(provider='sqlite', filename='Views/Weponbase.sqlite', create_db=True) set_sql_debug(True) db.generate_mapping(create_tables=True) with db_session: cl1 = Client(name_of_human="Nova", s_name_of_human="Strike", age_of_human=20, type_of_visit=False) cl2 = Client(name_of_human="Vova", s_name_of_human="Pyke", age_of_human=30, type_of_visit=False) cl3 = Client(name_of_human="Lex", s_name_of_human="Strike", age_of_human=20, type_of_visit=True) cl4 = Client(name_of_human="Rex", s_name_of_human="Strike", age_of_human=25, type_of_visit=True) of1 = ShootingOfficer(name_of_human="Jacob",