def test_get_org_head() -> None:
    e1 = Employee(1, "Boss", "CEO", 50000, 50)
    assert e1.get_organization_head().eid == 1
    e2 = Employee(2, "Sue", "Manager", 20000, 50)
    e2.become_subordinate(e1)
    assert e2.get_organization_head().eid == 1
    e3 = Employee(3, "Emma", "Worker", 10000, 50)
    e3.become_subordinate(e2)
    assert e3.get_organization_head().eid == 1
예제 #2
0
def test_get_organization_head() -> None:
    e1 = Employee(1, "Emma Ployee", "Worker", 10000, 50)
    e2 = Employee(2, "Sue Perior", "Manager", 20000, 30)
    e3 = Employee(3, "Bigg Boss", "CEO", 50000, 60)
    e1.become_subordinate(e2)
    e2.become_subordinate(e3)
    assert e1.get_organization_head().name == 'Bigg Boss'
예제 #3
0
def test_employee_general() -> None:
    e1 = Employee(1, "e1", "a", 1, 50)
    e2 = Employee(2, "e2", "a", 1, 50)
    e3 = Employee(3, "e3", "a", 1, 50)
    e4 = Employee(4, "e4", "a", 1, 50)
    e5 = Employee(5, "e5", "a", 1, 50)
    e6 = Employee(6, "e6", "a", 1, 50)
    e7 = Employee(7, "e7", "a", 1, 50)
    e7.become_subordinate(e5)
    e5.become_subordinate(e2)
    e4.become_subordinate(e2)
    e2.become_subordinate(e1)
    e3.become_subordinate(e1)
    e6.become_subordinate(e3)
    assert e6.get_all_subordinates() == []
    assert e2.get_all_subordinates() == [e4, e5, e7]
    assert e2.get_direct_subordinates() == [e4, e5]
    assert e7.get_organization_head() == e1
    assert e1.get_organization_head() == e1
    assert e7.get_closest_common_superior(4) == e2
    assert e2.get_closest_common_superior(4) == e2
    assert e2.get_closest_common_superior(7) == e2

    # assert e7.become_leader("seven") == e1
    assert len(e5.get_direct_subordinates()) == 1

    e7 = e5.get_direct_subordinates()[0]
    # assert isinstance(e7, Leader)
    assert e1.get_highest_rated_subordinate() == e2
    assert e5.get_highest_rated_subordinate().eid == 7
    # assert e7.get_department_leader() == e7

    # assert e2.become_leader('two') == e1
    e2 = e1.get_direct_subordinates()[0]
    assert e2.eid == 2

    assert e1.become_leader('one').eid == 1
    e1 = e2.become_leader(3)
예제 #4
0
def test_get_organization_head_advanced() -> None:
    e1 = Employee(1, "Emma Ployee", "Worker", 10000, 50)
    e2 = Employee(2, "Sue Perior", "Manager", 20000, 30)
    e3 = Employee(3, "Robocop", "Worker", 20000, 30)
    e4 = Leader(4, "Sarah", "CEO", 20000, 30, "Some Corp.")
    e5 = Employee(5, "Sofia", "Worker", 20000, 30)
    e6 = Employee(6, "Terry", "Worker", 20000, 30)
    e7 = Employee(7, "Odysseus", "Worker", 20000, 30)
    e1.become_subordinate(e2)
    e3.become_subordinate(e2)
    e2.become_subordinate(e4)
    e5.become_subordinate(e2)
    e6.become_subordinate(e4)
    e7.become_subordinate(e4)
    assert e1.get_organization_head() == e4