# Path: invenio_communities/communities/records/api.py
# class Community(Record):
#     """Community API."""
# 
#     pid = PIDField('id', provider=CommunitiesIdProvider, create=False)
#     schema = ConstantField(
#         '$schema', 'local://communities/communities-v1.0.0.json')
# 
#     model_cls = models.CommunityMetadata
# 
#     index = IndexField(
#         "communities-communities-v1.0.0",
#         search_alias="communities"
#     )
# 
#     access = CommunityAccessField()
# 
#     bucket_id = ModelField(dump=False)
#     bucket = ModelField(dump=False)
#     files = FilesField(
#         store=False,
#         file_cls=CommunityFile,
#         # Don't delete, we'll manage in the service
#         delete=False,
#     )


import pytest
from jsonschema import ValidationError
from mock_module.api import MockRecord
from sqlalchemy.exc import IntegrityError
from invenio_communities.communities.records.api import Community
# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 CERN.
#
# Invenio-Communities is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.

"""Data layer tests for record/community integration."""




@pytest.fixture()
def c(app, db, location):
    """A community fixture."""
    _c = Community.create({})
    db.session.commit()
    return Community.get_record(_c.id)

@pytest.fixture()
def c2(app, db, location):
    """Another community fixture."""
    _c = Community.create({})
    db.session.commit()

# Path: invenio_communities/communities/records/api.py
# class Community(Record):
#     """Community API."""
# 
#     pid = PIDField('id', provider=CommunitiesIdProvider, create=False)
#     schema = ConstantField(
#         '$schema', 'local://communities/communities-v1.0.0.json')
# 
#     model_cls = models.CommunityMetadata
# 
#     index = IndexField(
#         "communities-communities-v1.0.0",
#         search_alias="communities"
#     )
# 
#     access = CommunityAccessField()
# 
#     bucket_id = ModelField(dump=False)
#     bucket = ModelField(dump=False)
#     files = FilesField(
#         store=False,
#         file_cls=CommunityFile,
#         # Don't delete, we'll manage in the service
#         delete=False,
#     )


# Path: tests/records/test_mockrecords_api.py
import pytest
from jsonschema import ValidationError
from mock_module.api import MockRecord
from sqlalchemy.exc import IntegrityError
from invenio_communities.communities.records.api import Community

# -*- coding: utf-8 -*-
#
# Copyright (C) 2021 CERN.
#
# Invenio-Communities is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.

"""Data layer tests for record/community integration."""




@pytest.fixture()
def c(app, db, location):
    """A community fixture."""
    _c = Community.create({})
    db.session.commit()
    return Community.get_record(_c.id)

@pytest.fixture()
def c2(app, db, location):
    """Another community fixture."""
    _c = Community.create({})
    db.session.commit()

    return Community.get_record(_c.id)