Beispiel #1
0
    def test_create_report(self, input, mock_show_complaint, mock_conn):
        input.side_effect = [1, 'cause', 'details', 10, 10]
        test_class = SupervisorService.Supervisor()

        result = test_class.create_report()

        assert result is True
Beispiel #2
0
    def test_show_reports_empty(self, mock_conn):
        mock_conn.return_value.cursor.return_value.fetchall.return_value = []
        test_class = SupervisorService.Supervisor()

        result = test_class.show_reports()

        assert result is False
Beispiel #3
0
    def test_login_invalid_user(self, inputs, mock_conn):
        inputs.return_value = '*****@*****.**'
        mock_conn.return_value.cursor.return_value.fetchone.return_value = None
        test_class = SupervisorService.Supervisor()

        result = test_class.supervisor_login()

        assert result is False
Beispiel #4
0
    def test_show_complaint(self, mock_conn):
        mock_conn.return_value.cursor.return_value.fetchall.return_value = [
            (1, 'gas leakout', 'test comments')
        ]
        test_class = SupervisorService.Supervisor()

        result = test_class.show_complaint()

        assert result is True
Beispiel #5
0
    def test_login_password_match(self, inputs, mock_conn, getpass):
        inputs.return_value = '*****@*****.**'
        getpass.return_value = 'pass'
        mock_conn.return_value.cursor.return_value.fetchone.return_value = (
            '*****@*****.**', 'pass', 1, 'TeamName')
        test_class = SupervisorService.Supervisor()

        result = test_class.supervisor_login()

        assert result is True
Beispiel #6
0
    def test_show_reports(self, mock_conn):
        mock_conn.return_value.cursor.return_value.fetchall.return_value = [
            (1, 1, 'soul', 'short circuit', 'test details', 10, 5, 'approved',
             '2020-05-14 12:41:24')
        ]
        test_class = SupervisorService.Supervisor()

        result = test_class.show_reports()

        assert result is True
Beispiel #7
0
    def test_worker_tasks(self, inputs, mock_show_complaint,
                          mock_create_report, mock_show_reports):
        inputs.side_effect = ['1', '2', '3', '6', '4']
        test_class = SupervisorService.Supervisor()

        test_class.supervisor_tasks()

        mock_show_complaint.assert_called_once_with()
        mock_create_report.assert_called_once_with()
        mock_show_reports.assert_called_once_with()
Beispiel #8
0
    def test_create_report_failure(self):
        test_class = SupervisorService.Supervisor()

        result = test_class.create_report()

        assert result is False
Beispiel #9
0
    num = 0
    conn = create_connection()

    while ch != '4':

        print("MAIN MENU")
        print("1. Admin Login")
        print("2. Supervisor Login")
        print("3. Worker Login")
        print("4. Exit")
        ch = input("Select Your Option ")

        if ch == '1':
            admin = AdminService.Admin()
            if admin.admin_login():
                admin.admin_tasks()
        elif ch == '2':
            supervisor = SupervisorService.Supervisor()
            if supervisor.supervisor_login():
                supervisor.supervisor_tasks()

        elif ch == '3':
            worker = WorkerService.Worker()
            if worker.worker_login():
                worker.worker_tasks()

        elif ch == '4':
            print("Thank You.")
        else:
            print("Invalid choice")