def setUp(self):
        TestManageAccounts.confirm_app_in_testing_mode()

        from POS import app
        app.testing = True
        app.config["JSONIFY_PRETTYPRINT_REGULAR"] = False
        self.test_app = app.test_client()

        AppDB.db_session.commit()
        AppDB.BaseModel.metadata.drop_all()
        AppDB.BaseModel.metadata.create_all()

        from POS.models.user_management.role import Role
        AppDB.load_default_roles(Role)

        # Add at least 2 users (one being the owner of a business)

        # user #1 details
        self.user_1_name = "lipaless_user"
        self.user_1_email = "*****@*****.**"
        self.user_1_password = "******"

        # signup as user #1
        self.signup(
            name=self.user_1_name,
            email=self.user_1_email,
            password=self.user_1_password
        )
        # logout as user #1
        self.logout()

        # Signup as owner
        self.owner_name = "lipaless_owner"
        self.owner_email = "*****@*****.**"
        self.owner_password = "******"

        self.signup(
            name=self.owner_name,
            email=self.owner_email,
            password=self.owner_password
        )

        # create business #1 that links the users
        self.business_1_name = "lipaless_business"
        self.add_business(
            name=self.business_1_name,
            contact_number="0712345678"
        )

        business_1 = AppDB.db_session.query(Business).filter(
            Business.name == self.business_1_name
        ).first()
        self.business_1_id = business_1.id

        # logout as owner
        self.logout()
Example #2
0
    def setUp(self):
        TestLogin.confirm_app_in_testing_mode()

        from POS import app
        app.testing = True
        app.config["JSONIFY_PRETTYPRINT_REGULAR"] = False
        self.test_app = app.test_client()

        AppDB.db_session.commit()
        AppDB.BaseModel.metadata.drop_all()
        AppDB.BaseModel.metadata.create_all()
    def setUp(self):
        TestManageAccounts.confirm_app_in_testing_mode()
        app.testing = True
        app.config["JSONIFY_PRETTYPRINT_REGULAR"] = False
        self.test_app = app.test_client()

        AppDB.db_session.commit()
        AppDB.BaseModel.metadata.drop_all()
        AppDB.BaseModel.metadata.create_all()

        from POS.models.user_management.role import Role
        AppDB.load_default_roles(Role)

        # Create 3 users: owner, admin, cashier
        self.create_users()
Example #4
0
    def init_test_app(self):
        """
            Create the application test client
            and set up the database
            :return:
        """
        BaseTestCase.confirm_app_in_testing_mode()

        from POS import app
        app.testing = True
        app.config["JSONIFY_PRETTYPRINT_REGULAR"] = False
        self.test_app = app.test_client()

        # Initialize the database
        BaseTestCase.init_test_db()
Example #5
0
    def setUp(self):
        TestBusiness.confirm_app_in_testing_mode()

        from POS import app
        app.testing = True
        app.config["JSONIFY_PRETTYPRINT_REGULAR"] = False
        self.test_app = app.test_client()

        AppDB.db_session.commit()
        AppDB.BaseModel.metadata.drop_all()
        AppDB.BaseModel.metadata.create_all()

        from POS.models.user_management.role import Role
        AppDB.load_default_roles(Role)

        # Business details
        self.test_business_name = "mandazi poa"
        self.test_contact_number = "0712345678"

        # Business related functionality requires one to have logged in so create users

        # Perform a signup
        self.user_1_name = "lipaless guy"
        self.user_1_email = "*****@*****.**"
        self.user_1_password = "******"

        self.signup(name=self.user_1_name,
                    email=self.user_1_email,
                    password=self.user_1_password)

        # Logout as user 1
        self.logout()

        # Sign up user 2
        self.user_2_name = "lipaless guy_2"
        self.user_2_email = "*****@*****.**"
        self.user_2_password = "******"

        self.signup(name=self.user_2_name,
                    email=self.user_2_email,
                    password=self.user_2_password)

        # Logout as user 2
        self.logout()