Пример #1
0
def employeelist():
    obj = Employee()
    users = obj.getEmployeeList()
    if users == False:
        return render_template("EmployeeList.html", users=False)
    else:
        return render_template("EmployeeList.html", users=users)
Пример #2
0
class TestEmployeeGiveRaise(unittest.TestCase):

   def setUp(self):
    
       self.testtarget = Employee("Bob","Green",10000)
       self.addnum = 8000
       self.right_salary1 = 15000
       self.right_salary2 = 18000

   def test_give_default(self):
       self.testtarget.give_raise()
       self.assertEqual(self.testtarget.salary_by_year,self.right_salary1)

   def test_give_custom_raise(self):
       self.testtarget.give_raise(self.addnum)
       self.assertEqual(self.testtarget.salary_by_year,self.right_salary2)
 def __init__(self, master):
     Frame.__init__(self, master)
     self.notebook = ttk.Notebook()
     self.tab1 = Department(self.notebook)
     self.tab2 = Employee(self.notebook)
     self.notebook.add(self.tab1, text="Departments")
     self.notebook.add(self.tab2, text="Employees")
     self.notebook.pack()
Пример #4
0
def main():
    print('\n---------------------------------------------')
    print('--- Welcome to the Employee PowerBall !!! ---')
    print('---------------------------------------------\n')

    powerball = PowerBall()
    not_done = True
    while not_done:
        emp = Employee()
        emp.add_info()

        powerball.add_employee(emp)
        print('\n')
        not_done = continue_adding()

    powerball.select_winning_number()
    print(powerball)
Пример #5
0
class TestEmployee(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        print("setup Class")

    @classmethod
    def tearDownClass(cls):
        print("tearDown Class")

    def setUp(self):
        print("Setup")
        self.emp_1 = Employee("David", "Henkemeyer", 40000)
        self.emp_2 = Employee("Bill", "Johnson", 70000)

    def tearDown(self):
        print("Teardown")
        pass

    def test_email(self):
        print("Test Email")
        self.assertEqual(self.emp_1.email, '*****@*****.**')
        self.assertEqual(self.emp_2.email, '*****@*****.**')

        self.emp_1.first = "Gabriel"
        self.emp_2.first = "Jane"

        self.assertEqual(self.emp_1.email, '*****@*****.**')
        self.assertEqual(self.emp_2.email, '*****@*****.**')

    def test_fullname(self):
        print("Test Fullname")
        self.assertEqual(self.emp_1.fullname, "David Henkemeyer")
        self.assertEqual(self.emp_2.fullname, "Bill Johnson")

        self.emp_1.first = "Gabriel"
        self.emp_2.first = "Jane"

        self.assertEqual(self.emp_1.fullname, "Gabriel Henkemeyer")
        self.assertEqual(self.emp_2.fullname, "Jane Johnson")

    def test_monthly_schedule(self):
        with patch('Employees.requests.get') as mocked_get:
            mocked_get.return_value.ok = True
            mocked_get.return_value.text = 'Success'
            schedule = self.emp_1.monthly_schedule('May')
            mocked_get.assert_called_with('http://company.com/Henkemeyer/May')
            self.assertEqual(schedule, 'Success')
Пример #6
0
from Employees import Employee

#Employee.setName(Employee,"patti")
print(f"at 1:{Employee._name}")
print(f"at 1.5:{Employee()._name}")
c1 = Employee()
print(f"at 1.9:{c1._name}")
c1._name = "temp"

print(f"at 2:{c1._name}")
print(f"at 3:{Employee._name}")

c3 = Employee
print(f"at 2.5:{c3._name}")

c1.setName("deepa")
print(f"at 4:{c1._name}")
print(f"at 5:{Employee._name}")
c2 = Employee()
c2.setName("mithun")
print(c2._name)
print(c1._name)
print(Employee._name)
Пример #7
0
 def setUp(self):
     print("Setup")
     self.emp_1 = Employee("David", "Henkemeyer", 40000)
     self.emp_2 = Employee("Bill", "Johnson", 70000)
Пример #8
0
 def setUp(self):
  
     self.testtarget = Employee("Bob","Green",10000)
     self.addnum = 8000
     self.right_salary1 = 15000
     self.right_salary2 = 18000
Пример #9
0
 def setUp(self):
     self.powerball = PowerBall()
     self.emp1 = Employee('Wade', 'Wilson', [1, 2, 3, 4, 5], 23)
     self.emp2 = Employee('Frank', 'Castle', [1, 62, 33, 24, 15], 22)
     self.emp3 = Employee('Austin', 'Powers', [1, 2, 3, 4, 5], 23)
Пример #10
0
import unittest
from unittest import mock
import sys, os

sys.path.append(os.path.abspath('./'))
from MainTest import ResponseGenerator
from PowerBall import PowerBall
from Employees import Employee

EMPLOYEES_LIST = [
    Employee('A', 'A', [1, 2, 3, 4, 5], 23),
    Employee('B', 'B', [1, 2, 3, 5, 4], 23),
    Employee('C', 'C', [1, 2, 3, 4, 69], 23),
    Employee('D', 'D', [1, 2, 3, 40, 50], 12),
    Employee('E', 'E', [1, 2, 30, 23, 33], 12),
    Employee('F', 'F', [1, 22, 21, 20, 31], 15)
]

random_num = iter(ResponseGenerator([1, 2, 3, 4, 5]))


class PowerBallTest(unittest.TestCase):
    def setUp(self):
        self.powerball = PowerBall()
        self.emp1 = Employee('Wade', 'Wilson', [1, 2, 3, 4, 5], 23)
        self.emp2 = Employee('Frank', 'Castle', [1, 62, 33, 24, 15], 22)
        self.emp3 = Employee('Austin', 'Powers', [1, 2, 3, 4, 5], 23)

    def test_init(self):
        self.assertIsInstance(self.powerball, PowerBall)
        print('PowerBall init test pass')
Пример #11
0
import unittest
from Employees import Employee
em = Employee(1, "anush", 100)
da_expectedResult = 12
empno_expectedResult = 1
empname_expectedResult = 'anush'
Basicsalary_expectedResult = 100
hra_expectedResult = 20
it_expectedResult = 15
pf_expectedResult = 12
gs_expectedResult = 132
ns_expectedResult = 105


class TestEmployee(unittest.TestCase):
    def test_da(self):
        result = em.DA()
        self.assertEqual(result, da_expectedResult)
        #self.assertNotEqual(result,da_expectedResult)
    def test_empno(self):
        result = em.Empno()
        self.assertEqual(result, empno_expectedResult)

    def test_empname(self):
        result = em.Ename()
        self.assertEqual(result, empname_expectedResult)

    def test_BasicSalary(self):
        result = em.BasicSalary()
        self.assertEqual(result, Basicsalary_expectedResult)
Пример #12
0
	def setUp(self):
		self.emp = Employee()
		self.emp2 = Employee(FIRST_NAME, LAST_NAME, FAVORTE_NUMBERS, POWERBALL)
Пример #13
0
class EmployeesTest(unittest.TestCase):
	
	def setUp(self):
		self.emp = Employee()
		self.emp2 = Employee(FIRST_NAME, LAST_NAME, FAVORTE_NUMBERS, POWERBALL)

	def test_init(self):
		self.assertIsInstance(self.emp, Employee)
		self.assertIsInstance(self.emp2, Employee)
		print("Employee init test pass")

	def test_str(self):
		expected = 'Wade Wilson 15 26 33 60 34 Power Ball: 16'
		result = str(self.emp2)
		self.assertEqual(result, expected)
		print("Employee str test pass")

	@mock.patch('builtins.input', first_names.mock_response)
	def test_GetFirstName(self):
		self.emp.get_first_name()
		self.assertEqual(self.emp.first_name, 'John-Paul')
		print('Employee get_first_name method test pass')

	@mock.patch('builtins.input', last_names.mock_response)
	def test_GetLastName(self):
		self.emp.get_last_name()
		self.assertEqual(self.emp.last_name, 'Smithers')
		print('Employee get_last_name method test pass')

	@mock.patch('builtins.input', favorites.mock_response)
	def test_GetFavoriteNumbers(self):
		self.emp.get_favorite_numbers()
		expected = [1, 3, 5, 60, 34]
		self.assertEqual(self.emp.favorite_numbers, expected)
		print('Employee get_favorite_numbers method test pass')

	@mock.patch('builtins.input', powerballs.mock_response)
	def test_GetPowerball(self):
		self.emp.get_powerball()
		self.assertEqual(self.emp.powerball, 23)
		print('Employee get_powerball method test pass')

	def test_BuildExcludingString(self):
		#len(favorite_numbers) == 1
		self.emp.favorite_numbers = [1]
		expected = '1'
		result = self.emp.build_excluding_string()
		self.assertEqual(result, expected)

		#len(favorite_numbers) == 2
		self.emp.favorite_numbers = [1, 2]
		expected = '1 and 2'
		result = self.emp.build_excluding_string()
		self.assertEqual(result, expected)

		#len(favorite_numbers) == 3
		self.emp.favorite_numbers = [1, 2, 3]
		expected = '1, 2, and 3'
		result = self.emp.build_excluding_string()
		self.assertEqual(result, expected)

		#len(favorite_numbers) > 3
		self.emp.favorite_numbers = [1, 2, 3, 4]
		expected = '1, 2, 3, and 4'
		result = self.emp.build_excluding_string()
		self.assertEqual(result, expected)
		print('Employee build_excluding_string method test pass')

	@mock.patch('Employees.Employee.get_first_name', return_value=None)
	@mock.patch('Employees.Employee.get_last_name', return_value=None)
	@mock.patch('Employees.Employee.get_favorite_numbers', return_value=None)
	@mock.patch('Employees.Employee.get_powerball', return_value=None)
	def test_AddInfo(self, mockFirst, mockLast, mockFavorites, mockPowerball):
		self.assertIsNone(self.emp2.add_info())
		print('Employee add_info method test pass')