diff --git a/tests/fixtures/microsoft_face_create_person.json b/tests/components/microsoft_face/fixtures/create_person.json similarity index 100% rename from tests/fixtures/microsoft_face_create_person.json rename to tests/components/microsoft_face/fixtures/create_person.json diff --git a/tests/fixtures/microsoft_face_persongroups.json b/tests/components/microsoft_face/fixtures/persongroups.json similarity index 100% rename from tests/fixtures/microsoft_face_persongroups.json rename to tests/components/microsoft_face/fixtures/persongroups.json diff --git a/tests/fixtures/microsoft_face_persons.json b/tests/components/microsoft_face/fixtures/persons.json similarity index 100% rename from tests/fixtures/microsoft_face_persons.json rename to tests/components/microsoft_face/fixtures/persons.json diff --git a/tests/components/microsoft_face/test_init.py b/tests/components/microsoft_face/test_init.py index dd99a1d48aa..63014a095c0 100644 --- a/tests/components/microsoft_face/test_init.py +++ b/tests/components/microsoft_face/test_init.py @@ -134,15 +134,15 @@ async def test_setup_component_test_entities( """Set up component.""" aioclient_mock.get( ENDPOINT_URL.format("persongroups"), - text=load_fixture("microsoft_face_persongroups.json"), + text=load_fixture("persongroups.json", "microsoft_face"), ) aioclient_mock.get( ENDPOINT_URL.format("persongroups/test_group1/persons"), - text=load_fixture("microsoft_face_persons.json"), + text=load_fixture("persons.json", "microsoft_face"), ) aioclient_mock.get( ENDPOINT_URL.format("persongroups/test_group2/persons"), - text=load_fixture("microsoft_face_persons.json"), + text=load_fixture("persons.json", "microsoft_face"), ) with assert_setup_component(3, mf.DOMAIN): @@ -202,15 +202,15 @@ async def test_service_person( """Set up component, test person services.""" aioclient_mock.get( ENDPOINT_URL.format("persongroups"), - text=load_fixture("microsoft_face_persongroups.json"), + text=load_fixture("persongroups.json", "microsoft_face"), ) aioclient_mock.get( ENDPOINT_URL.format("persongroups/test_group1/persons"), - text=load_fixture("microsoft_face_persons.json"), + text=load_fixture("persons.json", "microsoft_face"), ) aioclient_mock.get( ENDPOINT_URL.format("persongroups/test_group2/persons"), - text=load_fixture("microsoft_face_persons.json"), + text=load_fixture("persons.json", "microsoft_face"), ) with assert_setup_component(3, mf.DOMAIN): @@ -220,7 +220,7 @@ async def test_service_person( aioclient_mock.post( ENDPOINT_URL.format("persongroups/test_group1/persons"), - text=load_fixture("microsoft_face_create_person.json"), + text=load_fixture("create_person.json", "microsoft_face"), ) aioclient_mock.delete( ENDPOINT_URL.format( @@ -274,15 +274,15 @@ async def test_service_face( """Set up component, test person face services.""" aioclient_mock.get( ENDPOINT_URL.format("persongroups"), - text=load_fixture("microsoft_face_persongroups.json"), + text=load_fixture("persongroups.json", "microsoft_face"), ) aioclient_mock.get( ENDPOINT_URL.format("persongroups/test_group1/persons"), - text=load_fixture("microsoft_face_persons.json"), + text=load_fixture("persons.json", "microsoft_face"), ) aioclient_mock.get( ENDPOINT_URL.format("persongroups/test_group2/persons"), - text=load_fixture("microsoft_face_persons.json"), + text=load_fixture("persons.json", "microsoft_face"), ) CONFIG["camera"] = {"platform": "demo"} diff --git a/tests/fixtures/microsoft_face_detect.json b/tests/components/microsoft_face_detect/fixtures/detect.json similarity index 100% rename from tests/fixtures/microsoft_face_detect.json rename to tests/components/microsoft_face_detect/fixtures/detect.json diff --git a/tests/components/microsoft_face_detect/fixtures/persongroups.json b/tests/components/microsoft_face_detect/fixtures/persongroups.json new file mode 100644 index 00000000000..5bbb8ceea29 --- /dev/null +++ b/tests/components/microsoft_face_detect/fixtures/persongroups.json @@ -0,0 +1,12 @@ +[ + { + "personGroupId": "test_group1", + "name": "test group1", + "userData": "test" + }, + { + "personGroupId": "test_group2", + "name": "test group2", + "userData": "test" + } +] diff --git a/tests/components/microsoft_face_detect/fixtures/persons.json b/tests/components/microsoft_face_detect/fixtures/persons.json new file mode 100644 index 00000000000..e604bcc2672 --- /dev/null +++ b/tests/components/microsoft_face_detect/fixtures/persons.json @@ -0,0 +1,21 @@ +[ + { + "personId": "25985303-c537-4467-b41d-bdb45cd95ca1", + "name": "Ryan", + "userData": "User-provided data attached to the person", + "persistedFaceIds": [ + "015839fb-fbd9-4f79-ace9-7675fc2f1dd9", + "fce92aed-d578-4d2e-8114-068f8af4492e", + "b64d5e15-8257-4af2-b20a-5a750f8940e7" + ] + }, + { + "personId": "2ae4935b-9659-44c3-977f-61fac20d0538", + "name": "David", + "userData": "User-provided data attached to the person", + "persistedFaceIds": [ + "30ea1073-cc9e-4652-b1e3-d08fb7b95315", + "fbd2a038-dbff-452c-8e79-2ee81b1aa84e" + ] + } +] diff --git a/tests/components/microsoft_face_detect/test_image_processing.py b/tests/components/microsoft_face_detect/test_image_processing.py index b1aa2a00c85..0c0bcb59c0b 100644 --- a/tests/components/microsoft_face_detect/test_image_processing.py +++ b/tests/components/microsoft_face_detect/test_image_processing.py @@ -97,15 +97,15 @@ async def test_ms_detect_process_image( """Set up and scan a picture and test plates from event.""" aioclient_mock.get( ENDPOINT_URL.format("persongroups"), - text=load_fixture("microsoft_face_persongroups.json"), + text=load_fixture("persongroups.json", "microsoft_face_detect"), ) aioclient_mock.get( ENDPOINT_URL.format("persongroups/test_group1/persons"), - text=load_fixture("microsoft_face_persons.json"), + text=load_fixture("persons.json", "microsoft_face_detect"), ) aioclient_mock.get( ENDPOINT_URL.format("persongroups/test_group2/persons"), - text=load_fixture("microsoft_face_persons.json"), + text=load_fixture("persons.json", "microsoft_face_detect"), ) await async_setup_component(hass, ip.DOMAIN, CONFIG) @@ -127,7 +127,7 @@ async def test_ms_detect_process_image( aioclient_mock.post( ENDPOINT_URL.format("detect"), - text=load_fixture("microsoft_face_detect.json"), + text=load_fixture("detect.json", "microsoft_face_detect"), params={"returnFaceAttributes": "age,gender"}, ) diff --git a/tests/components/microsoft_face_identify/fixtures/detect.json b/tests/components/microsoft_face_identify/fixtures/detect.json new file mode 100644 index 00000000000..c43f4ec494e --- /dev/null +++ b/tests/components/microsoft_face_identify/fixtures/detect.json @@ -0,0 +1,27 @@ +[ + { + "faceId": "c5c24a82-6845-4031-9d5d-978df9175426", + "faceRectangle": { + "width": 78, + "height": 78, + "left": 394, + "top": 54 + }, + "faceAttributes": { + "age": 71.0, + "gender": "male", + "smile": 0.88, + "facialHair": { + "mustache": 0.8, + "beard": 0.1, + "sideburns": 0.02 + }, + "glasses": "sunglasses", + "headPose": { + "roll": 2.1, + "yaw": 3, + "pitch": 0 + } + } + } +] diff --git a/tests/fixtures/microsoft_face_identify.json b/tests/components/microsoft_face_identify/fixtures/identify.json similarity index 100% rename from tests/fixtures/microsoft_face_identify.json rename to tests/components/microsoft_face_identify/fixtures/identify.json diff --git a/tests/components/microsoft_face_identify/fixtures/persongroups.json b/tests/components/microsoft_face_identify/fixtures/persongroups.json new file mode 100644 index 00000000000..5bbb8ceea29 --- /dev/null +++ b/tests/components/microsoft_face_identify/fixtures/persongroups.json @@ -0,0 +1,12 @@ +[ + { + "personGroupId": "test_group1", + "name": "test group1", + "userData": "test" + }, + { + "personGroupId": "test_group2", + "name": "test group2", + "userData": "test" + } +] diff --git a/tests/components/microsoft_face_identify/fixtures/persons.json b/tests/components/microsoft_face_identify/fixtures/persons.json new file mode 100644 index 00000000000..e604bcc2672 --- /dev/null +++ b/tests/components/microsoft_face_identify/fixtures/persons.json @@ -0,0 +1,21 @@ +[ + { + "personId": "25985303-c537-4467-b41d-bdb45cd95ca1", + "name": "Ryan", + "userData": "User-provided data attached to the person", + "persistedFaceIds": [ + "015839fb-fbd9-4f79-ace9-7675fc2f1dd9", + "fce92aed-d578-4d2e-8114-068f8af4492e", + "b64d5e15-8257-4af2-b20a-5a750f8940e7" + ] + }, + { + "personId": "2ae4935b-9659-44c3-977f-61fac20d0538", + "name": "David", + "userData": "User-provided data attached to the person", + "persistedFaceIds": [ + "30ea1073-cc9e-4652-b1e3-d08fb7b95315", + "fbd2a038-dbff-452c-8e79-2ee81b1aa84e" + ] + } +] diff --git a/tests/components/microsoft_face_identify/test_image_processing.py b/tests/components/microsoft_face_identify/test_image_processing.py index 59a93bd9db5..6258448dd05 100644 --- a/tests/components/microsoft_face_identify/test_image_processing.py +++ b/tests/components/microsoft_face_identify/test_image_processing.py @@ -99,15 +99,15 @@ async def test_ms_identify_process_image( """Set up and scan a picture and test plates from event.""" aioclient_mock.get( ENDPOINT_URL.format("persongroups"), - text=load_fixture("microsoft_face_persongroups.json"), + text=load_fixture("persongroups.json", "microsoft_face_identify"), ) aioclient_mock.get( ENDPOINT_URL.format("persongroups/test_group1/persons"), - text=load_fixture("microsoft_face_persons.json"), + text=load_fixture("persons.json", "microsoft_face_identify"), ) aioclient_mock.get( ENDPOINT_URL.format("persongroups/test_group2/persons"), - text=load_fixture("microsoft_face_persons.json"), + text=load_fixture("persons.json", "microsoft_face_identify"), ) await async_setup_component(hass, ip.DOMAIN, CONFIG) @@ -129,11 +129,11 @@ async def test_ms_identify_process_image( aioclient_mock.post( ENDPOINT_URL.format("detect"), - text=load_fixture("microsoft_face_detect.json"), + text=load_fixture("detect.json", "microsoft_face_identify"), ) aioclient_mock.post( ENDPOINT_URL.format("identify"), - text=load_fixture("microsoft_face_identify.json"), + text=load_fixture("identify.json", "microsoft_face_identify"), ) common.async_scan(hass, entity_id="image_processing.test_local")