'Test the media server image proxy server .'

def test_media_image_proxy(self):

    fake_picture_data = 'test.test'
    class MockResponse:
        def __init__(self):
            self.status = 200
            self.headers = {'Content-Type': 'sometype'}
        @asyncio.coroutine
        def read(self):
            return fake_picture_data.encode('ascii')
        @asyncio.coroutine
        def release(self):
            pass
    class MockWebsession:
        @asyncio.coroutine
        def get(self, url):
            return MockResponse()
        def detach(self):
            pass
    self.hass.data[DATA_CLIENTSESSION] = MockWebsession()
    assert self.hass.states.is_state(entity_id, 'playing')
    state = self.hass.states.get(entity_id)
    req = requests.get((HTTP_BASE_URL + state.attributes.get('entity_picture')))
    assert (req.status_code == 200)
    assert (req.text == fake_picture_data)
