'Setup component, test person face services.'

@patch('homeassistant.components.camera.async_get_image', return_value=mock_coro('Test'))
def test_service_face(self, camera_mock, aioclient_mock):

    aioclient_mock.get(self.endpoint_url.format('persongroups'), text=load_fixture('microsoft_face_persongroups.json'))
    aioclient_mock.get(self.endpoint_url.format('persongroups/test_group1/persons'), text=load_fixture('microsoft_face_persons.json'))
    aioclient_mock.get(self.endpoint_url.format('persongroups/test_group2/persons'), text=load_fixture('microsoft_face_persons.json'))
    self.config['camera'] = {'platform': 'demo'}
    with assert_setup_component(3, mf.DOMAIN):
        setup_component(self.hass, mf.DOMAIN, self.config)
    assert (len(aioclient_mock.mock_calls) == 3)
    aioclient_mock.post(self.endpoint_url.format('persongroups/test_group2/persons/2ae4935b-9659-44c3-977f-61fac20d0538/persistedFaces'), status=200, text='{}')
    mf.face_person(self.hass, 'test_group2', 'David', 'camera.demo_camera')
    self.hass.block_till_done()
    assert (len(aioclient_mock.mock_calls) == 4)
    assert (aioclient_mock.mock_calls[3][2] == 'Test')
