Exemple #1
0
 def __init__(self):
     """ Virtually private constructor. """
     if Security.__instance is not None:
         errorLogger("This class is a singleton!")
         raise Exception("This class is a singleton!")
     else:
         Security.__instance = self
 def test_success(self):
     try:
         res = self.init_sys()
         self.assertTrue(res)
     except ResourceWarning:
         errorLogger("System down warning")
         self.assertTrue(True, "System down warning")
 def __init__(self):
     """ Virtually private constructor. """
     if PaymentProxy.__instance is not None:
         errorLogger("This class is a singleton!")
         raise Exception("This class is a singleton!")
     else:
         super().__init__()
         PaymentProxy.__instance = self
 def test_communication_error_delivery(self):
     try:
         # communication error with delivery
         res = self.init_sys()
         self.cause_connection_err_delivery()
         self.assertTrue(False)
     except ResourceWarning:
         errorLogger("System down warning")
         self.assertTrue(True, "System down warning")
Exemple #5
0
 def __init__(self):
     """ Virtually private constructor. """
     if DeliveryProxy.__instance is not None:
         errorLogger("This class is a singleton!")
         raise Exception("This class is a singleton!")
     else:
         super().__init__()
         # self.__isConnected = False
         # if DeliveryProxy.__realSubject:
         #     DeliveryProxy.__instance = self.__realSubject
         # else:
         DeliveryProxy.__instance = self
 def __init__(self):
     """ Virtually private constructor. """
     if StoreData.__instance is not None:
         errorLogger("This class is a singleton!")
         raise Exception("This class is a singleton!")
     else:
         self.__tbl = Store
         self.__attr_store_name = "store_name"
         self.__attr_founder_username = "******"
         self.__attributes_as_dictionary = {
             self.__attr_store_name: self.__tbl.store_name,
             self.__attr_founder_username: self.__tbl.founder_username
         }
         StoreData.__instance = self
Exemple #7
0
 def __init__(self):
     """ Virtually private constructor. """
     if ProductsInBasketData.__instance is not None:
         errorLogger("This class is a singleton!")
         raise Exception("This class is a singleton!")
     else:
         self.__tbl = ProductsInBasket
         self.__attr_username = "******"
         self.__attr_product_ref = "product_ref"
         self.__attr_amount = "amount"
         self.__attributes_as_dictionary = {self.__attr_username: self.__tbl.username,
                                            self.__attr_product_ref: self.__tbl.product_ref,
                                            self.__attr_amount: self.__tbl.amount}
         ProductsInBasketData.__instance = self
Exemple #8
0
 def __init__(self):
     """ Virtually private constructor. """
     if StoreManagerAppointmentData.__instance is not None:
         errorLogger("This class is a singleton!")
         raise Exception("This class is a singleton!")
     else:
         self.__tbl = StoreManagerAppointment
         self.__attr_appointee_username = "******"
         self.__attr_store_name = "store_name"
         self.__attr_appointer_username = "******"
         self.__attr_can_edit_inventory = "can_edit_inventory"
         self.__attr_can_edit_policies = "can_edit_policies"
         self.__attr_can_appoint_owner = "can_appoint_owner"
         self.__attr_can_delete_owner = "can_delete_owner"
         self.__attr_can_appoint_manager = "can_appoint_manager"
         self.__attr_can_edit_manager_permissions = "can_edit_manager_permissions"
         self.__attr_can_delete_manager = "can_delete_manager"
         self.__attr_can_close_store = "can_close_store"
         self.__attr_can_answer_user_questions = "can_answer_user_questions"
         self.__attr_can_watch_purchase_history = "can_watch_purchase_history"
         self.__attributes_as_dictionary = {
             self.__attr_appointee_username:
             self.__tbl.appointee_username,
             self.__attr_store_name:
             self.__tbl.store_name,
             self.__attr_appointer_username:
             self.__tbl.appointer_username,
             self.__attr_can_edit_inventory:
             self.__tbl.can_edit_inventory,
             self.__attr_can_edit_policies:
             self.__tbl.can_edit_policies,
             self.__attr_can_appoint_owner:
             self.__tbl.can_appoint_owner,
             self.__attr_can_delete_owner:
             self.__tbl.can_delete_owner,
             self.__attr_can_appoint_manager:
             self.__tbl.can_appoint_manager,
             self.__attr_can_edit_manager_permissions:
             self.__tbl.can_edit_manager_permissions,
             self.__attr_can_delete_manager:
             self.__tbl.can_delete_manager,
             self.__attr_can_close_store:
             self.__tbl.can_close_store,
             self.__attr_can_answer_user_questions:
             self.__tbl.can_answer_user_questions,
             self.__attr_can_watch_purchase_history:
             self.__tbl.can_watch_purchase_history
         }
         StoreManagerAppointmentData.__instance = self
 def __init__(self):
     """ Virtually private constructor. """
     if DbProxy.__instance is not None:
         errorLogger("This class is a singleton!")
         raise Exception("This class is a singleton!")
     else:
         super().__init__()
         self.__isConnected = False
         if DbProxy.__realSubject:
             DbProxy.__instance = self
             self.__real_doesnt_exist_error_msg = "We having some tech problems, but we will rise again!"
             self.__realSubject.connect()
             self.__realSubject.create_tables()
         else:
             DbProxy.__instance = self
Exemple #10
0
 def __init__(self):
     """ Virtually private constructor. """
     if UserData.__instance is not None:
         errorLogger("This class is a singleton!")
         raise Exception("This class is a singleton!")
     else:
         self.__tbl = User
         self.__attr_username = "******"
         self.__attr_password = "******"
         self.__attr_is_system_manager = "is_system_manager"
         self.__attributes_as_dictionary = {
             self.__attr_username: self.__tbl.username,
             self.__attr_password: self.__tbl.password,
             self.__attr_is_system_manager: self.__tbl.is_system_manager
         }
         UserData.__instance = self
 def __init__(self):
     """ Virtually private constructor. """
     if PurchaseData.__instance is not None:
         errorLogger("This class is a singleton!")
         raise Exception("This class is a singleton!")
     else:
         self.__tbl = Purchase
         self.__attr_purchase_id = "purchase_id"
         self.__attr_username = "******"
         self.__attr_store_name = "store_name"
         self.__attr_total_price = "total_price"
         self.__attr_date = "date"
         self.__attributes_as_dictionary = {self.__attr_purchase_id: self.__tbl.purchase_id,
                                            self.__attr_store_name: self.__tbl.store_name,
                                            self.__attr_username: self.__tbl.username,
                                            self.__attr_total_price: self.__tbl.total_price,
                                            self.__attr_date: self.__tbl.date}
         PurchaseData.__instance = self
 def __init__(self):
     """ Virtually private constructor. """
     if CompositeDiscountPolicyData.__instance is not None:
         errorLogger("This class is a singleton!")
         raise Exception("This class is a singleton!")
     else:
         self.__tbl = CompositeDiscountPolicy
         self.__attr_policy_ref = "policy_ref"
         self.__attr_policy1_ref = "policy1_ref"
         self.__attr_policy2_ref = "policy2_ref"
         self.__attr_flag = "flag"
         self.__attributes_as_dictionary = {
             self.__attr_policy_ref: self.__tbl.policy_ref,
             self.__attr_policy1_ref: self.__tbl.policy1_ref,
             self.__attr_policy2_ref: self.__tbl.policy2_ref,
             self.__attr_flag: self.__tbl.flag
         }
         CompositeDiscountPolicyData.__instance = self
 def __init__(self):
     """ Virtually private constructor. """
     if ProductsInPurchaseData.__instance is not None:
         errorLogger("This class is a singleton!")
         raise Exception("This class is a singleton!")
     else:
         self.__tbl = ProductsInPurchase
         self.__attr_purchase_id = "purchase_id"
         self.__attr_product_name = "product_name"
         self.__attr_product_purchase_price = "product_purchase_price"
         self.__attr_amount = "amount"
         self.__attributes_as_dictionary = {
             self.__attr_purchase_id: self.__tbl.purchase_id,
             self.__attr_product_name: self.__tbl.product_name,
             self.__attr_product_purchase_price:
             self.__tbl.product_purchase_price,
             self.__attr_amount: self.__tbl.amount
         }
         ProductsInPurchaseData.__instance = self
 def __init__(self):
     """ Virtually private constructor. """
     if StatisticData.__instance is not None:
         errorLogger("This class is a singleton!")
         raise Exception("This class is a singleton!")
     else:
         self.__tbl = Statistic
         self.__attr_date = "date"
         self.__attr_guests = "guests"
         self.__attr_subscribers = "subscribers"
         self.__attr_store_managers = "store_managers"
         self.__attr_store_owners = "owners"
         self.__attr_system_managers = "system_managers"
         self.__attributes_as_dictionary = {
             self.__attr_date: self.__tbl.date,
             self.__attr_guests: self.__tbl.guests,
             self.__attr_subscribers: self.__tbl.subscribers,
             self.__attr_store_managers: self.__tbl.store_managers,
             self.__attr_store_owners: self.__tbl.store_owners,
             self.__attr_system_managers: self.__tbl.system_managers
         }
         StatisticData.__instance = self
 def __init__(self):
     """ Virtually private constructor. """
     if ConditionalDiscountPolicyData.__instance is not None:
         errorLogger("This class is a singleton!")
         raise Exception("This class is a singleton!")
     else:
         self.__tbl = ConditionalDiscountPolicy
         self.__attr_policy_ref = "policy_ref"
         self.__attr_precondition_product = "precondition_product"
         self.__attr_precondition_min_amount = "precondition_min_amount"
         self.__attr_precondition_min_basket_price = "precondition_min_basket_price"
         self.__attributes_as_dictionary = {
             self.__attr_policy_ref:
             self.__tbl.policy_ref,
             self.__attr_precondition_product:
             self.__tbl.precondition_product,
             self.__attr_precondition_min_amount:
             self.__tbl.precondition_min_amount,
             self.__attr_precondition_min_basket_price:
             self.__tbl.precondition_min_basket_price
         }
         ConditionalDiscountPolicyData.__instance = self
 def __init__(self):
     """ Virtually private constructor. """
     if DiscountPolicyData.__instance is not None:
         errorLogger("This class is a singleton!")
         raise Exception("This class is a singleton!")
     else:
         self.__tbl = DiscountPolicy
         self.__attr_discount_policy_id = "discount_policy_id"
         self.__attr_policy_name = "policy_name"
         self.__attr_store_name = "store_name"
         self.__attr_product_name = "product_name"
         self.__attr_percentage = "percentage"
         self.__attr_valid_until = "valid_until"
         self.__attr_is_active = "is_active"
         self.__attributes_as_dictionary = {
             self.__attr_discount_policy_id: self.__tbl.discount_policy_id,
             self.__attr_policy_name: self.__tbl.policy_name,
             self.__attr_store_name: self.__tbl.store_name,
             self.__attr_product_name: self.__tbl.product_name,
             self.__attr_percentage: self.__tbl.percentage,
             self.__attr_valid_until: self.__tbl.valid_until,
             self.__attr_is_active: self.__tbl.is_active
         }
         DiscountPolicyData.__instance = self