diff --git a/testing/design/test_item.py b/testing/design/test_item.py index c93c97f..498a87b 100644 --- a/testing/design/test_item.py +++ b/testing/design/test_item.py @@ -3,25 +3,27 @@ def test_item_creation_and_properties(): - item = Item(number="123", description="Test Item", model="Model123", manufacturer="Test Manufacturer", serial="ABC456") + item = Item("123", "Test Item", "Model123", "Test Manufacturer", "ABC456", "RM1", "2019") assert item.number == "123" assert item.description == "Test Item" assert item.model == "Model123" assert item.manufacturer == "Test Manufacturer" assert item.serial == "ABC456" + assert item.room == "RM1" + assert item.last_update == "2019" def test_item_string_representation(): - item = Item(number="789", description="Another Item", model="Model789", manufacturer="Another Manufacturer", serial="DEF789") + item = Item("789", "Another Item", "Model789", "Another Manufacturer", "DEF789", "RM1", "2019") assert str(item) == "789 - Another Item" def test_item_hashing_and_eq(): - item1 = Item("111", "Item A", "ModelA", "ManufacturerA", "AAA111") - item2 = Item("222", "Item B", "ModelB", "ManufacturerB", "BBB222") - item3 = Item("111", "Item C", "ModelC", "ManufacturerC", "CCC333") + item1 = Item("111", "Item A", "ModelA", "ManufacturerA", "AAA111", "RM1", "2019") + item2 = Item("222", "Item B", "ModelB", "ManufacturerB", "BBB222", "RM1", "2019") + item3 = Item("111", "Item C", "ModelC", "ManufacturerC", "CCC333", "RM1", "2019") assert len({item1, item2}) == 2 assert len({item1, item3}) == 1 diff --git a/testing/design/test_job.py b/testing/design/test_job.py index 0e713c7..7bf7bbc 100644 --- a/testing/design/test_job.py +++ b/testing/design/test_job.py @@ -8,7 +8,7 @@ def test_job_creation_and_properties(): - job = Job("CAMPEYN - ABLE VICTORIA", "CampusA", "DepartmentY") + job = Job("CAMPEYN - ABLE VICTORIA", "CampusA", "DepartmentY", "123") assert job.company == "ABLE" assert job.campus == "CampusA" @@ -17,10 +17,10 @@ def test_job_creation_and_properties(): def test_job_add_test(): - job = Job("CompanyX", "CampusA", "DepartmentY") + job = Job("CompanyX", "CampusA", "DepartmentY", "123") - test1 = Test(Item("001", "Test Item 1", "ModelX", "ManufacturerX", "XYZ001")) - test2 = Test(Item("002", "Test Item 2", "ModelY", "ManufacturerY", "XYZ002")) + test1 = Test(Item("001", "Test Item 1", "ModelX", "ManufacturerX", "XYZ001", "RM1", "2019")) + test2 = Test(Item("002", "Test Item 2", "ModelY", "ManufacturerY", "XYZ002", "RM1", "2019")) custom1 = Script("Custom1", "Custom Script", (), exact_matches=["Test Item 1"]) SCRIPTS["Custom1"] = custom1 @@ -42,9 +42,9 @@ def test_job_add_test(): def test_job_remove_test() -> None: custom1 = Script("Custom1", "Custom Script", (), exact_matches=["Test Item 1"]) SCRIPTS["Custom1"] = custom1 - test1 = Test(Item("001", "Test Item 1", "ModelX", "ManufacturerX", "XYZ001")) + test1 = Test(Item("001", "Test Item 1", "ModelX", "ManufacturerX", "XYZ001", "RM1", "2019")) test1.script = test1.determine_script() - job = Job("CompanyX", "CampusA", "DepartmentY") + job = Job("CompanyX", "CampusA", "DepartmentY", "123") job.add_test(test1) job.remove_test(test1) @@ -55,19 +55,19 @@ def test_job_remove_test() -> None: def test_job_string_representation(): - job1 = Job("CAMPEYN - YOORALLA", "CampusA", "DepartmentY") - job2 = Job("BENETAS - ST PAULS", "CampusA", "DepartmentY") - job3 = Job("JEWISH ST KILDA", "CampusA", "DepartmentY") + job1 = Job("CAMPEYN - YOORALLA", "CampusA", "DepartmentY", "123") + job2 = Job("BENETAS - ST PAULS", "CampusA", "DepartmentY", "123") + job3 = Job("JEWISH ST KILDA", "CampusA", "DepartmentY", "123") - assert str(job1) == "CampusA\nCAMPEYN\nDepartmentY" - assert str(job2) == "CampusA\nBENETAS\nDepartmentY" - assert str(job3) == "CampusA\nJEWISH CARE\nDepartmentY" + assert str(job1) == "CampusA\nCAMPEYN\n123" + assert str(job2) == "CampusA\nBENETAS\n123" + assert str(job3) == "CampusA\nJEWISH CARE\n123" def test_job_hashing_and_eq(): - job1 = Job("CompanyX", "CampusA", "DepartmentY") - job2 = Job("CompanyY", "CampusB", "DepartmentZ") - job3 = Job("CompanyZ", "CampusA", "DepartmentZ") + job1 = Job("CompanyX", "CampusA", "DepartmentY", "123") + job2 = Job("CompanyY", "CampusB", "DepartmentZ", "123") + job3 = Job("CompanyZ", "CampusA", "DepartmentZ", "123") assert len({job1, job2}) == 2 assert len({job1, job3}) == 1 assert hash(job1) != hash(job2) diff --git a/testing/design/test_test.py b/testing/design/test_test.py index 8a7a5bb..81d2124 100644 --- a/testing/design/test_test.py +++ b/testing/design/test_test.py @@ -11,7 +11,7 @@ def test_test_creation_and_properties(): - item = Item("001", "Test Item", "ModelX", "ManufacturerX", "XYZ001") + item = Item("001", "Test Item", "ModelX", "ManufacturerX", "XYZ001", "RM1", "2019") test = Test(item) with pytest.raises(ScriptError): @@ -25,7 +25,7 @@ def test_test_creation_and_properties(): def test_test_determine_script(): - item = Item("001", "Test Item", "ModelX", "ManufacturerX", "XYZ001") + item = Item("001", "Test Item", "ModelX", "ManufacturerX", "XYZ001", "RM1", "2019") test = Test(item) # Adding a custom script for testing @@ -40,7 +40,7 @@ def test_test_determine_script(): def test_test_add_testjob(): - item = Item("001", "SLING 123", "ModelX", "ManufacturerX", "XYZ001") + item = Item("001", "SLING 123", "ModelX", "ManufacturerX", "XYZ001", "RM1", "2019") test = Test(item) test.script = test.determine_script() @@ -54,7 +54,7 @@ def test_test_add_testjob(): def test_test_complete_and_full_info(): - item = Item("001", "Test Item", "ModelX", "ManufacturerX", "XYZ001") + item = Item("001", "Test Item", "ModelX", "ManufacturerX", "XYZ001", "RM1", "2019") test = Test(item) custom = Script("CustomScript", "Custom Script", (), exact_matches=["Test Item"]) @@ -74,7 +74,7 @@ def test_test_complete_and_full_info(): def test_test_item_model_property(): - item = Item("001", "Test Item", "ModelX", "ManufacturerX", "XYZ001") + item = Item("001", "Test Item", "ModelX", "ManufacturerX", "XYZ001", "RM1", "2019") test = Test(item) test.script = Script("CustomScript", "Custom Script") diff --git a/testing/design/test_test_job_manager.py b/testing/design/test_test_job_manager.py index d13aed4..fedde05 100644 --- a/testing/design/test_test_job_manager.py +++ b/testing/design/test_test_job_manager.py @@ -10,8 +10,8 @@ def test_test_job_manager_multiple_testjobs(): manager = TestJobManager() - item1 = Item("001", "Test Item 1", "ModelX", "ManufacturerX", "XYZ001") - job1 = Job("Company", "Campus", "Department") + item1 = Item("001", "Test Item 1", "ModelX", "ManufacturerX", "XYZ001", "R1", "2019") + job1 = Job("Company", "Campus", "Department", "123") testjob1 = TestJob("Quality Control", "John Doe", "Performing testing on batch 1") testjob2 = TestJob("Quality Control", "Jane Smith", "Inspection for defects") @@ -31,9 +31,9 @@ def test_test_job_manager_multiple_testjobs(): def test_test_job_manager_multiple_items(): manager = TestJobManager() - item1 = Item("001", "Test Item 1", "ModelX", "ManufacturerX", "XYZ001") - item2 = Item("002", "Test Item 2", "ModelY", "ManufacturerY", "XYZ002") - job1 = Job("Company", "Campus", "Department") + item1 = Item("001", "Test Item 1", "ModelX", "ManufacturerX", "XYZ001", "RM1", "2019") + item2 = Item("002", "Test Item 2", "ModelY", "ManufacturerY", "XYZ002", "RM1", "2019") + job1 = Job("Company", "Campus", "Department", "123") testjob1 = TestJob("Quality Control", "John Doe", "Performing testing on batch 1") manager.add_testjob(item1, job1, testjob1) diff --git a/testing/test_db_functions.py b/testing/test_db_functions.py index 1c72b21..dce7cf7 100644 --- a/testing/test_db_functions.py +++ b/testing/test_db_functions.py @@ -75,7 +75,7 @@ def test_get_job(job_number: str, mock_sql_job: sql_job) -> None: assert job.department == "dept" assert job.number == "number" assert job.company == "company" - assert mock_sql_job.called_with[0].endswith(job_number) + assert job_number in mock_sql_job.called_with[0] assert mock_sql_job.close_called @@ -89,5 +89,5 @@ def test_get_item(mock_sql_item: sql_job) -> None: assert item.model == "model" assert item.serial == "serial" assert item.room == "room" - assert mock_sql_item.called_with[0].endswith("123456") + assert "123456" in mock_sql_item.called_with[0] assert mock_sql_item.close_called