View the step-by-step solution to:

How to test CustomerTest.py by using customer class for unittest in python (Pycharm with flask software)? I'm confused with how to test

How to test CustomerTest.py by using customer class for unittest in python (Pycharm with flask software)? I'm confused with how to test CustomerTest.py by using unittest?


Customer.py of class

from app.Classes import Pallet
from copy import deepcopy


class Customer(object):
    """ A customer object for the sealanes prototype: have the following attributes:

    Attributes:
        id: an unique int identifier to identify a customer with.
        name: a string literal representing the customer's name
        address: a string literal representing the customer's address
    """

    # Constructor
    def __init__(self, customer_id, first_name, last_name, email, address, phone_number, pallets: Pallet):
        """ Return a Customer object."""
        self._customer_id = customer_id
        self._first_name = first_name
        self._last_name = last_name
        self._email = email
        self._address = address
        self._phone_number = phone_number
        self._pallets = deepcopy(pallets)

    # Return the customer's id
    @property
    def customer_id(self):
        """
        A Method to be used to return the Customer's id
        :return: Customer's id
        """

        return self._customer_id

    # Sets the customer's id to a predefined value
    @customer_id.setter
    def customer_id(self, value: int):
        """
        A method to be used when setting a Customer's id to a defined value
        :param value: An id to be set for a particular customer
        :return:
        """
        self._customer_id = value

    # Return the customer's first name
    @property
    def first_name(self):
        """
        A Method to be used to return the Customer's first name
        :return: Customer's first name
        """

        return self._first_name

    # Sets the customer's first name to a predefined value
    @first_name.setter
    def first_name(self, value):
        """
        A method to be used when setting a Customer's first name to a defined value
        :param value: A first name to be set for a particular customer
        :return:
        """
        self._first_name = value

    # Returns the customer's last name
    @property
    def last_name(self):
        """
        A Method to be used to return the Customer's last name
        :return: Customer's last name
        """

        return self._last_name

    # Set the customer's last name to a predefined value
    @last_name.setter
    def last_name(self, value):
        """
        A method to be used when setting a Customer's last name to a defined value
        :param value: A last name to be set for a particular customer
        :return:
        """
        self._last_name = value

    # Returns the Customer's Email address
    @property
    def email_address(self):
        """
        A Method to be used to return the Customer's Address
        :return: Customer's Email address
        """

        return self._email

    # Sets the Customer's Email Address to a predefined value
    @email_address.setter
    def email_address(self, value):
        """
        A method to be used when setting a Customer's email address to a defined value
        :param value: An address to be set for a particular customer
        :return:
        """
        self._email = value

    # Returns the customer's address location
    @property
    def address(self):
        """
        A Method to be used to return the Customer's address location
        :return: Customer's address location
        """

        return self._address

    # Set the customer's address location to a predefined value
    @address.setter
    def address(self, value):
        """
        A method to be used when setting a Customer's address location to a defined value
        :param value: An address location to be set for a particular customer
        :return:
        """
        self._address = value

    # Returns the customer's phone number
    @property
    def phone_number(self):
        """
        A Method to be used to return the Customer's phone number
        :return: Customer's phone number
        """
        return self._phone_number

    # Set the customer's phone number to a predefined value
    @phone_number.setter
    def phone_number(self, value):
        """
        A method to be used when setting a Customer's phone number to a defined value
        :param value: A phone number to be set for a particular customer
        :return:
        """
        self._phone_number = value

    # Retrieves the customer's information in a dictionary structure
    def retrieve_information(self):
        """ Returning a customer's information"""
        return {"ID": self._customer_id, "First name": self._first_name, "Last name": self._last_name,
                "E-mail": self._email, "Address": self._address, "Phone number": self._phone_number}

    # Storing the customer's information to the database
    def store_information(self):
        pass

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question