def test_read_missing_id(self, mock_get_store):
        """Raises an error when the id was not provided at init"""
        resource = Patient()
        mock_get_store.return_value.normalize_resource.return_value = resource
        r = BaseResource(resource=resource)

        with pytest.raises(BadRequest, match="Resource ID is required"):
            r.read()
        assert mock_get_store.return_value.read.call_count == 0
    def test_read(self, mock_get_store):
        """Test read method.

        Calls the read method of the fhirstore client
        and registers the resource.
        """
        resource = Patient(id="test")
        mock_get_store.return_value.normalize_resource.return_value = resource
        mock_get_store.return_value.read.return_value = resource

        r = BaseResource(id="test")

        r.read()
        mock_get_store.return_value.read.assert_called_once_with(
            "BaseResource", "test")
        assert r.resource == resource