def test_create_and_add_new_employee(self):
     # TODO write this test and then remove the self.fail() statement
     # Add some employees and verify they are present in the PhoneAssignments.employees list
     test_employee1 = Employee(2, 'Gary')
     test_PhoneAssignments = PhoneAssignments()
     test_PhoneAssignments.add_employee(test_employee1)
     self.assertIn('Gary', test_PhoneAssignments.employees)
Ejemplo n.º 2
0
 def test_create_and_add_new_employee(self):
     # write this test and then remove the self.fail() statement
     # Add some employees and verify they are present in the PhoneAssignments.employees list
     testAssignmentMgr = PhoneAssignments()
     test_employee = Employee(1, 'Yanis Varoufakis')
     testAssignmentMgr.add_employee(test_employee)
     self.assertIn(test_employee, testAssignmentMgr.employees)
Ejemplo n.º 3
0
 def test_create_and_add_new_employee(self):
     # TODO write this test and then remove the self.fail() statement
     # Add some employees and verify they are present in the PhoneAssignments.employees list
     employee1 = Employee(1, 'Zion')
     testAssignmentMgr = PhoneAssignments()
     testAssignmentMgr.add_employee(employee1)
     self.assertIn(employee1, testAssignmentMgr.employees)  
    def test_create_and_add_new_employee(self):
        # Add some employees and verify they are present in the PhoneAssignments.employees list
        testEmployee = Employee(1, 'Test Name')
        testAssignmentMgt = PhoneAssignments()

        testAssignmentMgt.add_employee(testEmployee)

        self.assertIn(testEmployee, testAssignmentMgt.employees)
Ejemplo n.º 5
0
    def test_assign_phone_to_employee(self):

        testPhone1 = Phone(1, 'Apple', 'iPhone 6')
        testEmployee1 = Employee(1, "Mark Hamil")
        testPhoneAssigmentsMgr = PhoneAssignments()
        testPhoneAssigmentsMgr.assign(testPhone1, testEmployee1)

        self.assertTrue(testPhone1.employee_id == testEmployee1.id)
    def test_assign_phone_to_the_employee_who_already_has_this_phone(self):
        # TODO The method should not make any changes but NOT raise a PhoneError if a phone
        # is assigned to the same user it is currenly assigned to.

        testEmployee = Employee(1, 'Danzig')
        testPhone = Phone(1, 'Metalocalypse', 'Dethphone')

        testAssignmentMgr = PhoneAssignments()
        testAssignmentMgr.assign(testPhone.id, testEmployee)
Ejemplo n.º 7
0
 def test_create_and_add_new_employee(self):
     # TODO write this test and then remove the self.fail() statement
     # Add some employees and verify they are present in the PhoneAssignments.employees list
     testEmployee1 = Employee(1, 'Taylor Swift')
     testEmployee2 = Employee(2, 'Kanye West')
     testAssignmentMgr = PhoneAssignments()
     testAssignmentMgr.add_employee(testEmployee1)
     testAssignmentMgr.add_employee(testEmployee2)
     self.assertTrue(testEmployee1, testAssignmentMgr.employees)
     self.assertTrue(testEmployee2, testAssignmentMgr.employees)
Ejemplo n.º 8
0
    def test_assign_phone_to_employee(self):
        # TODO write this test and remove the self.fail() statement
        # TODO you'll need to fix the assign method in PhoneAssignments

        testPhone1 = Phone(1, 'Apple', 'iPhone 6')
        testEmployee1 = Employee(1, "Jim Carey")
        testPhoneAssigmentsMgr = PhoneAssignments()
        testPhoneAssigmentsMgr.assign(testPhone1, testEmployee1)

        self.assertTrue(testPhone1.employee_id == testEmployee1.id)
Ejemplo n.º 9
0
    def test_assign_phone_to_the_employee_who_already_has_this_phone(self):
        # TODO The method should not make any changes but NOT raise a PhoneError if a phone
        # is assigned to the same user it is currently assigned to.

        testEmployee1 = Employee(1, "Jim Carey")
        testPhone1 = Phone(1, 'Apple', 'iPhone 6')

        testPhoneAssigmentsMgr = PhoneAssignments()
        testPhoneAssigmentsMgr.assign(testPhone1, testEmployee1)
        self.assertTrue(testPhone1.employee_id == testEmployee1.id))
Ejemplo n.º 10
0
    def test_create_and_add_new_employee(self):
        # TODO write this test and then remove the self.fail() statement
        testEmployee1 = Employee(1, 'Kobe')
        testEmployee2 = Employee(2, 'Simpson')

        testAssignmentmgr = PhoneAssignments()
        testAssignmentmgr.add_employee(testEmployee1)
        testAssignmentmgr.add_employee(testEmployee2)

        self.assertIn(testEmployee1, testAssignmentmgr.employees)
        self.assertIn(testEmployee2, testAssignmentmgr.employees)
Ejemplo n.º 11
0
    def test_create_and_add_new_employee(self):
        test_assignment_mgr = PhoneAssignments()

        test_employee1 = Employee(1, 'Kitty')
        test_employee2 = Employee(2, 'Puppy')

        test_assignment_mgr.add_employee(test_employee1)
        test_assignment_mgr.add_employee(test_employee2)

        self.assertTrue(test_employee1 in test_assignment_mgr.employees)
        self.assertTrue(test_employee2 in test_assignment_mgr.employees)
Ejemplo n.º 12
0
    def test_un_assign_phone(self):
        test_phone1 = Phone(1, "Bedrock", "Pterodactyl")
        test_employee1 = Employee(1, "Fred Flintstone")

        test_assignments_mgr = PhoneAssignments()
        test_assignments_mgr.add_phone(test_phone1)
        test_assignments_mgr.add_employee(test_employee1)
        test_assignments_mgr.assign(test_phone1.id, test_employee1)
        test_assignments_mgr.un_assign(test_phone1.id)

        self.assertIsNone(test_assignments_mgr.phones[0].employee_id)
    def test_create_and_add_new_employee(self):
        # TODO write this test and then remove the self.fail() statement
        # Add some employees and verify they are present in the PhoneAssignments.employees list
        employee1 = Employee(1, 'Qaalib')
        employee2 = Employee(2, 'Snoop Dog')

        testAssignmentmgr = PhoneAssignments()
        testAssignmentmgr.add_employee(employee1)
        testAssignmentmgr.add_employee(employee2)
        self.assertIs(0, testAssignmentmgr.employees.index(employee1))
        self.assertIs(1, testAssignmentmgr.employees.index(employee2))
Ejemplo n.º 14
0
    def test_create_and_add_new_employee(self):
        # Add some employees and verify they are present in the PhoneAssignments.employees list
        testEmployee1 = Employee(1, "Mark Hamil")
        testEmployee2 = Employee(2, "Carrie Fisher")
        testEmployee3 = Employee(3, "Harrison Ford")
        testPhoneAssigmentsMgr = PhoneAssignments()
        testPhoneAssigmentsMgr.add_employee(testEmployee3)

        testEmployees = [ testEmployee1, testEmployee2 ]

        self.assertCountEqual(testEmployees, testPhoneAssigmentsMgr.employees)
 def test_un_assign_phone(self):
     # TODO write this test and remove the self.fail() statement
     # Assign a phone, unasign the phone, verify the employee_id is None
     testEmployee = Employee(1, 'Qaalib')
     testPhone = Phone(1, 'Apple', 'IPhone 10')
     testManager = PhoneAssignments()
     testManager.add_phone(testPhone)
     testManager.add_employee(testEmployee)
     testManager.assign(testPhone.id, testEmployee)
     testManager.un_assign(testPhone.id)
     self.assertIsNone(testPhone.employee_id)
Ejemplo n.º 16
0
 def test_un_assign_phone(self):
     # TODO write this test and remove the self.fail() statement
     # Assign a phone, unasign the phone, verify the employee_id is None
     testEmployee1 = Employee(1, 'Taylor Swift')
     testPhone1 = Phone(1, 'Apple', 'iPhone 6')
     testAssignmentMgr = PhoneAssignments()
     testAssignmentMgr.add_employee(testEmployee1)
     testAssignmentMgr.add_phone(testPhone1)
     testAssignmentMgr.assign(testPhone1.id, testEmployee1)
     testAssignmentMgr.unassign(testPhone1.id, testEmployee1)
     self.assertFalse(testEmployee1.id, testPhone1.employee_id)
Ejemplo n.º 17
0
    def test_un_assign_phone(self):
        # TODO write this test and remove the self.fail() statement
        # Assign a phone, unasign the phone, verify the employee_id is None
        employee = Employee(1, 'Jack')
        phone = Phone(1, 'Apple', 'iPhone 6')
        testAssignmentMgr = PhoneAssignments()
        testAssignmentMgr.add_employee(employee)
        testAssignmentMgr.add_phone(phone)
        testAssignmentMgr.assign(phone.id, employee)
        testAssignmentMgr.un_assign(phone.id)

        self.assertIsNone(phone.employee_id)
Ejemplo n.º 18
0
    def test_assign_phone_to_employee_who_already_has_a_phone(self):
        test_phone1 = Phone(1, "Samsung", "Galaxy S2")
        test_phone2 = Phone(2, "Bedrock", "Pterodactyl")
        test_employee1 = Employee(1, "Fred Flintstone")

        test_assignments_mgr = PhoneAssignments()
        test_assignments_mgr.add_phone(test_phone1)
        test_assignments_mgr.add_employee(test_employee1)
        test_assignments_mgr.assign(test_phone1.id, test_employee1)

        with self.assertRaises(PhoneError):
            test_assignments_mgr.assign(test_phone2, test_employee1)
Ejemplo n.º 19
0
    def test_assign_phone_to_the_employee_who_already_has_this_phone(self):
        test_phone = Phone(1, 'Apple', 'iPhone 420')
        test_employee = Employee(1, 'Snoop Dogg')

        test_assignment_manager = PhoneAssignments()
        test_assignment_manager.add_phone(test_phone)
        test_assignment_manager.add_employee(test_employee)

        test_assignment_manager.assign(1, test_employee)
        self.assertEqual(test_employee.id, test_phone.employee_id)
        test_assignment_manager.assign(1, test_employee)
        self.assertEqual(test_employee.id, test_phone.employee_id)
Ejemplo n.º 20
0
    def test_assign_phone_that_has_already_been_assigned_to_employee(self):
        test_phone1 = Phone(1, "Samsung", "Galaxy S2")
        test_employee1 = Employee(1, "Kitty Cat")
        test_employee2 = Employee(2, "Puppy Dog")

        test_assignments_mgr = PhoneAssignments()
        test_assignments_mgr.add_phone(test_phone1)
        test_assignments_mgr.add_employee(test_employee1)
        test_assignments_mgr.assign(test_phone1.id, test_employee1)

        with self.assertRaises(PhoneError):
            test_assignments_mgr.assign(test_phone1, test_employee2)
Ejemplo n.º 21
0
    def test_create_and_add_new_employee(self):
        # TODO write this test and then remove the self.fail() statement
        # Add some employees and verify they are present in the PhoneAssignments.employees list
        testEmployee1 = Employee(1, "Jim Carey")
        testEmployee2 = Employee(2, "Bob Dylan")
        testEmployee3 = Employee(3, "Michael Jordan")
        testPhoneAssigmentsMgr = PhoneAssignments()
        testPhoneAssigmentsMgr.add_employee(testEmployee3)

        testEmployees = [ testEmployee1, testEmployee2 ]

        self.assertCountEqual(testEmployees, testPhoneAssigmentsMgr.employees)
Ejemplo n.º 22
0
    def test_un_assign_phone(self):
        # write this test and remove the self.fail() statement
        # Assign a phone, unasign the phone, verify the employee_id is None
        test_PhoneAssignments = PhoneAssignments()
        employee1 = Employee(1, 'Alice')
        phone1 = Phone(1, 'Samsung', 'Galaxy Note 15')

        test_PhoneAssignments.add_employee(employee1)
        test_PhoneAssignments.add_phone(phone1)

        test_PhoneAssignments.assign(phone1.id, employee1)
        test_PhoneAssignments.un_assign(phone1.id)
        self.assertIsNone(phone1.employee_id)
    def test_un_assign_phone(self):
        # TODO write this test and remove the self.fail() statement
        # Assign a phone, unasign the phone, verify the employee_id is None

        testUnAssign = Phone(1, 'PhoneName', 'PhoneModel')
        testEmployee = Employee(1, 'EmployeeName')
        # This adds the data to the PhoneAssignments()
        testUnAssignMgr = PhoneAssignments()

        # The phone gets assigned.
        testUnAssignMgr.assign(testUnAssign, testEmployee)
        # This asserts that the phone is un-assigned.
        self.assertTrue(self, testUnAssignMgr.un_assign(testUnAssign.id))
    def test_assign_phone_to_employee(self):
        # TODO write this test and remove the self.fail() statement
        # TODO you'll need to fix the assign method in PhoneAssignments

        testAssigmentMgr = PhoneAssignments(
        )  # This is used for the phones and employees.

        testPhone1 = Phone(1, 'Apple', 'iPhone 6')
        testPhone3 = Phone(3, 'Apple', 'iPhone 7')

        testEmployee2 = Employee(4, 'Smith')
        # Had to modify this one to make it pass
        self.assertFalse(testAssigmentMgr.assign(testPhone3.id, testEmployee2))
    def test_un_assign_phone(self):
        # Assigns a phone, unasigns the phone, verifies the employee_id is None
        testEmployee = Employee(1, 'Test Name 1')
        testPhone = Phone(1, 'Test Brand', 'Test Model')

        testAssignmentMgr = PhoneAssignments()
        testAssignmentMgr.add_employee(testEmployee)
        testAssignmentMgr.add_phone(testPhone)

        testAssignmentMgr.assign(1, testEmployee)
        testAssignmentMgr.un_assign(1)

        self.assertTrue(testPhone.employee_id == None)
Ejemplo n.º 26
0
    def test_create_and_add_new_employee(self):

        # Add some employees and verify they are present in the PhoneAssignments.employees list
        testEmployee1 = Employee(1, 'Marissa')
        testEmployee2 = Employee(2, 'Christine')

        testEmployess = [testEmployee1, testEmployee2]

        testAssignmentMgr = PhoneAssignments()
        testAssignmentMgr.add_employee(testEmployee1)
        testAssignmentMgr.add_employee(testEmployee2)

        self.assertCountEqual(testEmployess, testAssignmentMgr.employees)
Ejemplo n.º 27
0
    def test_create_and_add_new_employee(self):
        # TODO write this test and then remove the self.fail() statement
        # Add some employees and verify they are present in the PhoneAssignments.employees list
        testemployee1 = Employee(1, 'test1')
        testemployee2 = Employee(2, 'test2')

        testemployees = [testemployee1, testemployee2]

        testAssignmentMgr = PhoneAssignments()
        testAssignmentMgr.add_employee(testemployee1)
        testAssignmentMgr.add_employee(testemployee2)

        self.assertCountEqual(testemployees, testAssignmentMgr.employees)
Ejemplo n.º 28
0
    def test_create_and_add_new_phone(self):
        testPhone1 = Phone(1, 'Apple', 'iPhone 6')
        testPhone2 = Phone(2, 'Apple', 'iPhone 5')

        testPhones = [testPhone1, testPhone2]

        testAssignmentMgr = PhoneAssignments()
        testAssignmentMgr.add_phone(testPhone1)
        testAssignmentMgr.add_phone(testPhone2)

        # assertCountEqual checks if two lists have the same items, in any order.
        # (Despite what the name implies)
        self.assertCountEqual(testPhones, testAssignmentMgr.phones)
Ejemplo n.º 29
0
    def test_create_and_add_new_employee(self):
        
        testEmployee1 = Employee(1, 'Mark')
        testEmployee2 = Employee(2, 'Ingrid')

        testAssignmentMgr = PhoneAssignments()
        testAssignmentMgr.add_employee(testEmployee1)
        testAssignmentMgr.add_employee(testEmployee2)

    

        self.assertIn(testEmployee1, testAssignmentMgr.employees)
        self.assertIn(testEmployee2, testAssignmentMgr.employees)
Ejemplo n.º 30
0
    def test_create_and_add_employee_with_duplicate_id(self):
        # write this test and then remove the self.fail() statement
        # you'll need to fix the add_employee method in PhoneAssignments to make this test PhoneAssignments
        # This method will be similar to test_create_and_add_phone_with_duplicate_id
        test_PhoneAssignments = PhoneAssignments()
        employee1 = Employee(1, 'Al')
        employee2 = Employee(1, 'Beatrice')

        test_PhoneAssignments.add_employee(employee1)
        test_PhoneAssignments.add_employee(employee2)

        self.assertIn(employee1, test_PhoneAssignments.employees)
        self.assertNotIn(employee2, test_PhoneAssignments.employees)