# Path: ricloud/resources/abase.py
# class Resource(ABResource):
#     RESOURCE = ""
#     RESOURCE_PATH = ""
# 
#     def __init__(self, *args, **attrs):
#         if args:
#             attrs["id"] = args[0]
#         super(Resource, self).__init__(**attrs)
# 
#     @classmethod
#     def resource_url(cls, resource_path=None):
#         resource_path = resource_path or cls.RESOURCE_PATH
#         return join_url(ricloud.url, resource_path)
# 
#     @property
#     def instance_url(self):
#         return "{}/{}".format(self.resource_url(), self.id)
# 
#     @classmethod
#     def retrieve(cls, id):
#         resource = cls(id=id)
#         resource.refresh()
#         return resource
# 
#     def refresh(self):
#         response, _ = self.request_handler.get(self.instance_url)
#         self.attrs = response
# 
# class List(ABList):
#     RESOURCE = "list"
# 
#     @property
#     def instance_url(self):
#         return self.url


import pytest
import ricloud
from ricloud.resources.abase import Resource, List
        assert resource_obj["attr1"] == "value1"

    def test_nested(self, nested_obj):
        assert nested_obj.id == "abcd1234"
        assert isinstance(nested_obj.nested, ResourceFixture)
        assert nested_obj.nested.id == "abcd123"

    def test_resource_url(self):
        assert ResourceFixture.resource_url() == ricloud.url + "/test/resource"

    def test_instance_url(self, resource_obj):
        assert resource_obj.instance_url == ricloud.url + "/test/resource/abcd1234"


@pytest.fixture
def list_obj():
    return List(
        **{
            "resource": "list",
            "data": [{"id": "abcd1234", "resource": "test_resource"}],
            "has_more": False,
            "total_count": 1,
            "url": "/users",
        }
    )


class TestList(object):
    def test_ok(self, list_obj):
        assert list_obj.data == [ResourceFixture(id="abcd1234")]

# Path: ricloud/resources/abase.py
# class Resource(ABResource):
#     RESOURCE = ""
#     RESOURCE_PATH = ""
# 
#     def __init__(self, *args, **attrs):
#         if args:
#             attrs["id"] = args[0]
#         super(Resource, self).__init__(**attrs)
# 
#     @classmethod
#     def resource_url(cls, resource_path=None):
#         resource_path = resource_path or cls.RESOURCE_PATH
#         return join_url(ricloud.url, resource_path)
# 
#     @property
#     def instance_url(self):
#         return "{}/{}".format(self.resource_url(), self.id)
# 
#     @classmethod
#     def retrieve(cls, id):
#         resource = cls(id=id)
#         resource.refresh()
#         return resource
# 
#     def refresh(self):
#         response, _ = self.request_handler.get(self.instance_url)
#         self.attrs = response
# 
# class List(ABList):
#     RESOURCE = "list"
# 
#     @property
#     def instance_url(self):
#         return self.url


# Path: tests/resources/test_abase.py
import pytest
import ricloud
from ricloud.resources.abase import Resource, List

        assert resource_obj["attr1"] == "value1"

    def test_nested(self, nested_obj):
        assert nested_obj.id == "abcd1234"
        assert isinstance(nested_obj.nested, ResourceFixture)
        assert nested_obj.nested.id == "abcd123"

    def test_resource_url(self):
        assert ResourceFixture.resource_url() == ricloud.url + "/test/resource"

    def test_instance_url(self, resource_obj):
        assert resource_obj.instance_url == ricloud.url + "/test/resource/abcd1234"


@pytest.fixture
def list_obj():
    return List(
        **{
            "resource": "list",
            "data": [{"id": "abcd1234", "resource": "test_resource"}],
            "has_more": False,
            "total_count": 1,
            "url": "/users",
        }
    )


class TestList(object):
    def test_ok(self, list_obj):
        assert list_obj.data == [ResourceFixture(id="abcd1234")]

        assert not list_obj.has_more