Пример #1
0
 def test_transfer_money(self):
     """
     Tests if customer able to Transfer amount  Successfully
     :return: Assertion of test fail or pass
     """
     self.test__init__()
     # open an existing account as destination
     # amount should Transfer to pass test
     dest_customer = Customer("Gulnaz")
     dest_customer.open_account(5)
     prev_balance = dest_customer.check_balance()
     self.my_customer.transfer_money(5, 50)
     self.assertEqual(self.my_customer.check_balance(),
                      50,
                      msg="Transfer from source Account")
     dest_customer.open_account(5)
     new_balance = dest_customer.check_balance()
     self.assertEqual(prev_balance + 50,
                      new_balance,
                      msg=" Amount not comes in destination Account")
     # open an account that not exist
     # amount should not transfer to pass test
     self.test__init__()
     self.my_customer.transfer_money(200, 50)
     self.assertEqual(self.my_customer.check_balance(),
                      100,
                      msg=" Amount Transfer But dest not exist")
Пример #2
0
 def test_open_account(self):
     """
     Tests if an account Open Suceesfully when exist
     and not opened when not exist
     :return: Assertion of test fail or pass
     """
     f_customer = Customer("huma")
     f_customer.open_account(2)
     self.assertNotEqual(f_customer.check_balance(),
                         -1,
                         msg=" Account Not Opened But it exists")
     s_customer = Customer("huma")
     s_customer.open_account(15)
     self.assertEqual(s_customer.check_balance(),
                      -1,
                      msg=" Account Open when it not exist")
Пример #3
0
 def test_request_new_account(self):
     """
     Tests when request for new account is made it is
     opened or not
     :return: Assertion of test fail or pass
     """
     dest_customer = Customer("Tempcust")
     dest_customer.request_new_account("S")
     dest_customer.deposit(500)
     acnt_no = dest_customer.get_account_number()
     dest_customer.open_account(acnt_no)
     self.assertEqual(dest_customer.check_balance(),
                      500,
                      msg=" New Account Not Opened")
Пример #4
0
def open_account_interface():
    """
    Prompt User to Enter valid account no and Customer Name
    :return: Customer instance for Current User
    """
    while True:
        print "Enter Account No"
        read_account = raw_input()
        print "Enter name"
        read_username = raw_input()
        current_customer = Customer(read_username)
        current_customer.open_account(int(read_account))
        if current_customer.check_balance() != -1:
            check_account_details_interface(current_customer)
            return current_customer
        else:
            print "Enter valid Account NO and Name"
Пример #5
0
class CustomerTestCases(unittest.TestCase):
    """
    This class tests the customer class operations
    via unit tests
    """
    def test__init__(self):
        """
        This initialize Customer attribute of Customer test cases
        :return: None
        """
        self.my_customer = Customer("Rabia")
        self.my_customer.account.c_id = 11
        self.my_customer.account.account_no = 11
        self.my_customer.account.account_type = "S"
        self.my_customer.account.balance = 100

    def test_balance(self):
        """
        Tests if balance is set successfully or not
        :return: Assertion of test fail or pass
        """
        self.test__init__()
        self.assertEqual(self.my_customer.account.balance,
                         100,
                         msg=" Balance not Set")

    def test_deposit(self):
        """
        Tests if deposit Work properly
        :return: Assertion of test fail or pass
        """
        self.test__init__()
        self.my_customer.deposit(500)
        self.assertEqual(self.my_customer.account.balance,
                         600,
                         msg=" Balance Not Updated after deposit")

    def test_withdraw(self):
        """
        Tests if withdraw Work properly
        :return: Assertion of test fail or pass
        """
        self.test__init__()
        self.my_customer.withdraw(50)
        self.assertEqual(self.my_customer.account.balance,
                         50,
                         msg=" Balance Not Updated after withdraw")
        self.my_customer.withdraw(500)
        self.assertEqual(self.my_customer.account.balance,
                         50,
                         msg=" Withdraw Even when Not enough amount Available")

    def test_check_balance(self):
        """
        Tests if Customer is able to check his balance
        :return:Assertion of test fail or pass
        """
        self.test__init__()
        self.assertEqual(self.my_customer.check_balance(),
                         100,
                         msg="Check balance not works Properly")

    def test_transfer_money(self):
        """
        Tests if customer able to Transfer amount  Successfully
        :return: Assertion of test fail or pass
        """
        self.test__init__()
        # open an existing account as destination
        # amount should Transfer to pass test
        dest_customer = Customer("Gulnaz")
        dest_customer.open_account(5)
        prev_balance = dest_customer.check_balance()
        self.my_customer.transfer_money(5, 50)
        self.assertEqual(self.my_customer.check_balance(),
                         50,
                         msg="Transfer from source Account")
        dest_customer.open_account(5)
        new_balance = dest_customer.check_balance()
        self.assertEqual(prev_balance + 50,
                         new_balance,
                         msg=" Amount not comes in destination Account")
        # open an account that not exist
        # amount should not transfer to pass test
        self.test__init__()
        self.my_customer.transfer_money(200, 50)
        self.assertEqual(self.my_customer.check_balance(),
                         100,
                         msg=" Amount Transfer But dest not exist")

    def test_pay_bills(self):
        """
        Tests if customer able to pay bills Successfully
        :return: Assertion of test fail or pass
        """
        self.test__init__()
        self.my_customer.pay_bills(50)
        self.assertEqual(self.my_customer.check_balance(),
                         50,
                         msg=" Bills not Pay")

    def test_request_new_account(self):
        """
        Tests when request for new account is made it is
        opened or not
        :return: Assertion of test fail or pass
        """
        dest_customer = Customer("Tempcust")
        dest_customer.request_new_account("S")
        dest_customer.deposit(500)
        acnt_no = dest_customer.get_account_number()
        dest_customer.open_account(acnt_no)
        self.assertEqual(dest_customer.check_balance(),
                         500,
                         msg=" New Account Not Opened")

    def test_open_account(self):
        """
        Tests if an account Open Suceesfully when exist
        and not opened when not exist
        :return: Assertion of test fail or pass
        """
        f_customer = Customer("huma")
        f_customer.open_account(2)
        self.assertNotEqual(f_customer.check_balance(),
                            -1,
                            msg=" Account Not Opened But it exists")
        s_customer = Customer("huma")
        s_customer.open_account(15)
        self.assertEqual(s_customer.check_balance(),
                         -1,
                         msg=" Account Open when it not exist")
Пример #6
0
						print(f"{'-' * 30}|")
						debet_saldo = int(input("Debet Saldo: "))
						'''
						if atm.check_balance <= 50000:
							print("[MESSAGE] - Maaf, minimal saldo yang tersisa setelah penarikan minimal IDR. {}")
						else:
							pass
						'''
						
						print(f"[MESSAGE]: Anda akan melakukan debet dengan nominal {debet_saldo}")
						verify_withdraw = input("KONFIRMASI [y/n]: ")
						
						if verify_withdraw == "y" or verify_withdraw == "Y":
							print(f"Saldo awal : IDR. {atm.check_balance()}")
							
							if debet_saldo < atm.check_balance():
								atm.withdraw_balance(debet_saldo)
								print(f"[SUCCESS] Transaksi debet berhasil!")
								print(f"Saldo tersisa: {atm.check_balance()}")
								
							else:
								print("[GAGAL] Maaf, saldo Anda tidak mencukupi untuk melakukan tarikan!")
								print("Silahkan melakukan penambahan saldo")
								
						elif verify_withdraw == "n" or verify_withdraw == "N":
							break
							
						else:
							print("pilihan tidak tersedia")
				
					elif select_menu == 3: