# Path: client/daprojects_python/daprojects_python/client.py
# class APIClient:
#     def __init__(self, host_url=None, auth_token=None):
#         if not host_url:
#             host_url = 'http://localhost:8000'
#         if not host_url.startswith('http'):
#             host_url = 'http://' + host_url
#         self.base_url = host_url.lower().strip() + '/api/v1'
#         if not auth_token:
#             auth_token = ''
#         self.auth_token = auth_token
# 
#     def list_resources(self, resource_url, resource_class, filters={}):
#         response = requests.get(
#             resource_url,
#             params=filters,
#             headers={'Authorization': 'Token {}'.format(self.auth_token)}
#         )
#         response.raise_for_status()
#         return [resource_class(**resource_data) for resource_data in response.json()]
# 
#     def retrieve_resource(self, resource_url, resource_class):
#         response = requests.get(
#             resource_url,
#             headers={'Authorization': 'Token {}'.format(self.auth_token)}
#         )
#         response.raise_for_status()
#         return resource_class(**response.json())
# 
#     def resource_action(self, action_url, action_data):
#         response = requests.post(
#             action_url,
#             data=json.dumps(action_data),
#             headers={
#                 'content-type': 'application/json',
#                 'Authorization': 'Token {}'.format(self.auth_token)
#             }
#         )
#         response.raise_for_status()
#         return response.json()
# 
# class APIResource:
#     def __init__(self, **kwargs):
#         for key, value in kwargs.items():
#             setattr(self, key, value)
# 
# Path: client/daprojects_python/daprojects_python/resources.py
# class DAProjectsAPI():
# 
#     def __init__(self, *args, **kwargs):
#         client = APIClient(*args, **kwargs)
#         self.projects = Projects(client)
#         self.modules = Modules(client)
#         self.issue_kinds = IssueKinds(client)
#         self.issues = Issues(client)
#         self.directories = Directories(client)


import unittest
import json
from unittest.mock import Mock, patch
from collections import namedtuple
from requests import exceptions
from .client import APIClient, APIResource
from .resources import DAProjectsAPI

            self.assertEqual(module.url, 'http://localhost:8000/api/v1/modules/1/')
            self.assertEqual(module.project, 'http://localhost:8000/api/v1/projects/1/')
            self.assertEqual(module.parent, None)
            self.assertEqual(module.children, [])
            self.assertEqual(module.name, 'Test Module 1')
            self.assertEqual(module.slug, 'test-module-1')
            self.assertEqual(module.description, 'Module description 1')
            self.assertEqual(module.directories, [])
            self.assertEqual(module.issues, [])

    def test_module_project(self):
        module = APIResource(**self._sample_module(1, project_id=1))
        self.assertEqual(module.project, 'http://localhost:8000/api/v1/projects/1/')

    def test_module_parent(self):
        module = APIResource(**self._sample_module(2, parent_id=1))
        self.assertEqual(module.parent, 'http://localhost:8000/api/v1/modules/1/')

    def test_module_children(self):
        module = APIResource(**self._sample_module(1, child_ids=[2, 3, 4]))
        for i, child_id in enumerate([2, 3, 4]):
            self.assertEqual(module.children[i], 'http://localhost:8000/api/v1/modules/{}/'.format(child_id))

    def test_module_directories(self):
        module = APIResource(**self._sample_module(1, directory_ids=[2, 3, 4]))
        for i, directory_id in enumerate([2, 3, 4]):
            self.assertEqual(module.directories[i], 'http://localhost:8000/api/v1/directories/{}/'.format(directory_id))

    def test_module_issues(self):

# Path: client/daprojects_python/daprojects_python/client.py
# class APIClient:
#     def __init__(self, host_url=None, auth_token=None):
#         if not host_url:
#             host_url = 'http://localhost:8000'
#         if not host_url.startswith('http'):
#             host_url = 'http://' + host_url
#         self.base_url = host_url.lower().strip() + '/api/v1'
#         if not auth_token:
#             auth_token = ''
#         self.auth_token = auth_token
# 
#     def list_resources(self, resource_url, resource_class, filters={}):
#         response = requests.get(
#             resource_url,
#             params=filters,
#             headers={'Authorization': 'Token {}'.format(self.auth_token)}
#         )
#         response.raise_for_status()
#         return [resource_class(**resource_data) for resource_data in response.json()]
# 
#     def retrieve_resource(self, resource_url, resource_class):
#         response = requests.get(
#             resource_url,
#             headers={'Authorization': 'Token {}'.format(self.auth_token)}
#         )
#         response.raise_for_status()
#         return resource_class(**response.json())
# 
#     def resource_action(self, action_url, action_data):
#         response = requests.post(
#             action_url,
#             data=json.dumps(action_data),
#             headers={
#                 'content-type': 'application/json',
#                 'Authorization': 'Token {}'.format(self.auth_token)
#             }
#         )
#         response.raise_for_status()
#         return response.json()
# 
# class APIResource:
#     def __init__(self, **kwargs):
#         for key, value in kwargs.items():
#             setattr(self, key, value)
# 
# Path: client/daprojects_python/daprojects_python/resources.py
# class DAProjectsAPI():
# 
#     def __init__(self, *args, **kwargs):
#         client = APIClient(*args, **kwargs)
#         self.projects = Projects(client)
#         self.modules = Modules(client)
#         self.issue_kinds = IssueKinds(client)
#         self.issues = Issues(client)
#         self.directories = Directories(client)


# Path: client/daprojects_python/daprojects_python/tests.py
import unittest
import json
from unittest.mock import Mock, patch
from collections import namedtuple
from requests import exceptions
from .client import APIClient, APIResource
from .resources import DAProjectsAPI


            self.assertEqual(module.url, 'http://localhost:8000/api/v1/modules/1/')
            self.assertEqual(module.project, 'http://localhost:8000/api/v1/projects/1/')
            self.assertEqual(module.parent, None)
            self.assertEqual(module.children, [])
            self.assertEqual(module.name, 'Test Module 1')
            self.assertEqual(module.slug, 'test-module-1')
            self.assertEqual(module.description, 'Module description 1')
            self.assertEqual(module.directories, [])
            self.assertEqual(module.issues, [])

    def test_module_project(self):
        module = APIResource(**self._sample_module(1, project_id=1))
        self.assertEqual(module.project, 'http://localhost:8000/api/v1/projects/1/')

    def test_module_parent(self):
        module = APIResource(**self._sample_module(2, parent_id=1))
        self.assertEqual(module.parent, 'http://localhost:8000/api/v1/modules/1/')

    def test_module_children(self):
        module = APIResource(**self._sample_module(1, child_ids=[2, 3, 4]))
        for i, child_id in enumerate([2, 3, 4]):
            self.assertEqual(module.children[i], 'http://localhost:8000/api/v1/modules/{}/'.format(child_id))

    def test_module_directories(self):
        module = APIResource(**self._sample_module(1, directory_ids=[2, 3, 4]))
        for i, directory_id in enumerate([2, 3, 4]):
            self.assertEqual(module.directories[i], 'http://localhost:8000/api/v1/directories/{}/'.format(directory_id))

    def test_module_issues(self):

        module = APIResource(**self._sample_module(1, issue_ids=[2, 3, 4]))