def test_number1(self, mockconnection, mockinput): mocksql = mock.Mock() mocksql.cursor().commit.return_value = True mocksql.cursor().fetchone.return_value = (1, 'shrey', 'shrey', 'Shreya', 'Bangalore', 560034, 27, None, None, None) g = Admin(mocksql, 1) m = g.number_1() assert m is True
def test_employeedetails(self, mockconnection): mocksql = mock.Mock() mocksql.cursor().fetchall.return_value = [(1, 'shrey', 'shrey', 'Shreya', 'Bangalore', 560034, 27, None, None, None, 'shreya', 'shreya', 'shreya', 'shreya')] g = Admin(mocksql, 1) m = g.employee_details() assert m is True
def test_number4(self, mockconnection, mockinput): mocksql = mock.Mock() mocksql.cursor().fetchall.return_value = [(1, 'shrey', 'shrey', 'Shreya', 'Bangalore', 560034, 27, None, None, None, 'shreya', 'shreya', 'shreya', 'shreya')] g = Admin(mocksql, 1) m = g.number_4() assert m is True
def test_addnewroute(self, mockconnection, mockinput): mocksql = mock.Mock() mocksql.cursor().commit.return_value = True mocksql.cursor().fetchall.return_value = [(1, 'shrey', 'shrey', 'Shreya', 'Bangalore', 560034, 27, None, None, None, 'shreya', 'shreya', 'shreya', 'shreya')] g = Admin(mocksql, 1) m = g.add_new_route() assert m is True
def admin_menu(self, con, id): """ function to view admin menu :param con: database connection object :param id: admin id :return: """ entry = '' while entry != 'exit': print('Following are the functions you can perform.') print('1 - Check total bookings') print('2 - Check bookings of an Employee') print('3 - Add new cab') print('4 - Update cab route and timings') print('5 - Add new Employee') print('6 - Update employee details') print('7 - Delete an employee') entry = builtins.input( 'Please enter the code associated with the function you want to perform:' ) if entry != 'exit': s = Admin(con, id) s.indirect(entry)
def test_number4_exception(self, mockconnection, mockinput): mocksql = mock.Mock() mocksql.cursor().execute.side_effect = sqlite3.Error g = Admin(mocksql, 1) m = g.number_4() assert m is False
def test_number7(self, mockconnection, mockinput, mockfunc): mocksql = mock.Mock() mocksql.cursor().commit.return_value = True g = Admin(mocksql, 1) m = g.number_7() assert m is True
def test_addnewroute_exception(self, mockconnection, mockinput): mocksql = mock.Mock() mocksql.cursor().execute.side_effect = sqlite3.Error g = Admin(mocksql, 1) m = g.add_new_route() assert m is False
def test_changeroute(self, mockconnection, mockinput): mocksql = mock.Mock() mocksql.cursor().commit.return_value = True g = Admin(mocksql, 1) m = g.change_route() assert m is True
def test_addnewtime(self, mockconnection, mockinput): mocksql = mock.Mock() mocksql.cursor().commit.return_value = True g = Admin(mocksql, 1) m = g.add_new_time() assert m is True
def test_employeedetails_exception(self, mockconnection, mockinput): mocksql = mock.Mock() mocksql.cursor().execute.side_effect = sqlite3.Error g = Admin(mocksql, 1) m = g.change_cab_time() assert m is False
def test_indirect(self, mockfunction, mockconnection): mocksql = mock.Mock() g = Admin(mocksql, 1) m = g.indirect(1) assert m is True
def test_employeedetails_exception(self, mockconnection): mocksql = mock.Mock() mocksql.cursor().execute.side_effect = sqlite3.Error g = Admin(mocksql, 1) m = g.employee_details() assert m is False