Beispiel #1
0
    def test_delete_missing_id(self, mock_get_db_connection):
        """Raises an error when the patch data is not provided
        """
        r = Resource(resource='test')

        with pytest.raises(OperationOutcome, match='Resource ID is required to delete \
it'):
            r = r.delete()
        assert mock_get_db_connection.return_value.update.call_count == 0
Beispiel #2
0
    def test_delete(self, mock_get_db_connection):
        """Calls the delete method of the fhirbase client
        """
        test_id = {'id': 'id'}
        mock_get_db_connection.return_value.delete.return_value = None
        r = Resource(id=test_id['id'])

        r = r.delete()
        mock_get_db_connection.return_value.delete.assert_called_once_with({
            'resourceType': 'Resource',
            'id': test_id['id']
        })
        assert r.resource is None
        assert r.id is None