# Path: memsource/constants.py
# class Base(enum.Enum):
# class JobStatus(enum.Enum):
# class ProjectStatus(enum.Enum):
# class AnalysisFormat(enum.Enum):
# class TermBaseFormat(enum.Enum):
# class ApiVersion(enum.Enum):
# class HttpMethod(enum.Enum):
# class BaseRest(enum.Enum):
# class JobStatusRest(enum.Enum):
#     NEW = "New"
#     EMAILED = "Emailed"
#     ASSIGNED = "Assigned"
#     DECLINED_BY_LINGUIST = "Declined_By_Linguist"
#     COMPLETED_BY_LINGUIST = "Completed_By_Linguist"
#     COMPLETED = "Completed"
#     CANCELLED = "Cancelled"
#     NEW = "New"
#     ASSIGNED = "Assigned"
#     COMPLETED = "Completed"
#     CANCELLED = "Cancelled"
#     ACCEPTED_BY_VENDOR = "Accepted_By_Vendor"
#     DECLINED_BY_VENDOR = "Declined_By_Vendor"
#     COMPLETED_BY_VENDOR = "Completed_By_Vendor"
#     CSV = "CSV"
#     LOG = "LOG"
#     CSV_EXTENDED = "CSV_EXTENDED"
#     XLSX = "XLSX"
#     TBX = "TBX"
#     NEW = "NEW"
#     ACCEPTED = "ACCEPTED"
#     DECLINED = "DECLINED"
#     REJECTED = "REJECTED"
#     DELIVERED = "DELIVERED"
#     EMAILED = "EMAILED"
#     COMPLETED = "COMPLETED"
#     CANCELLED = "CANCELLED"
# CHUNK_SIZE = 1024
# CHAR_SET = "UTF-8"
# TM_THRESHOLD = 0.7
# 
# Path: memsource/models.py
# class BaseModel(dict):
# class User(BaseModel):
# class Authentication(BaseModel):
# class Client(BaseModel):
# class Domain(BaseModel):
# class Language(BaseModel):
# class Project(BaseModel):
# class Job(BaseModel):
# class JobPart(BaseModel):
# class TranslationMemory(BaseModel):
# class AsynchronousRequest(BaseModel):
# class AsynchronousResponse(BaseModel):
# class Segment(BaseModel):
# class SegmentSearchResult(BaseModel):
# class Analysis(BaseModel):
# class MxliffUnit(BaseModel):
# class TermBase(BaseModel):
#     def __getattr__(self, key):
#     def _iso8601_to_datetime(self, source):
#     def date_created(self):
#     def __init__(self, source):
#     def is_complete(self):
#     def has_error(self):
# 
# Path: memsource/api_rest/domain.py
# class Domain(api_rest.BaseApi):
#     # Document: https://cloud.memsource.com/web/docs/api#tag/Domain
# 
#     def create(self, name: str) -> Dict[str, Any]:
#         return self._post("v1/domains", {"name": name})
# 
#     def get(self, domainID: int) -> models.Domain:
#         return models.Domain(self._get("v1/domains/{}".format(domainID)))
# 
#     def list(self, page: int=0) -> List[models.Domain]:
#         domains = self._get("v1/domains", {"page": page})
#         return [models.Domain(domain) for domain in domains.get("content", [])]


import requests
import unittest
from unittest.mock import patch
from memsource import constants, models
from memsource.api_rest.domain import Domain
        self.assertEqual(response, {
            "id": "mock-id",
            "name": "mock-test",
        })

        mock_request.assert_called_with(
            constants.HttpMethod.post.value,
            "https://cloud.memsource.com/web/api2/v1/domains",
            json={"name": "mock-test"},
            params={"token": "mock-token"},
            timeout=60
        )

    @patch.object(requests.Session, "request")
    def test_get(self, mock_request: unittest.mock):
        ms_response = unittest.mock.MagicMock(status_code=200)
        ms_response.json.return_value = {
            "id": "1",
            "name": "1",
        }
        mock_request.return_value = ms_response

        response = Domain(token="mock-token").get(1)
        expected = {
            "name": "1",
            "id": "1",
        }
        self.assertEqual(response, expected)
        self.assertIsInstance(response, models.Domain)
        mock_request.assert_called_with(

# Path: memsource/constants.py
# class Base(enum.Enum):
# class JobStatus(enum.Enum):
# class ProjectStatus(enum.Enum):
# class AnalysisFormat(enum.Enum):
# class TermBaseFormat(enum.Enum):
# class ApiVersion(enum.Enum):
# class HttpMethod(enum.Enum):
# class BaseRest(enum.Enum):
# class JobStatusRest(enum.Enum):
#     NEW = "New"
#     EMAILED = "Emailed"
#     ASSIGNED = "Assigned"
#     DECLINED_BY_LINGUIST = "Declined_By_Linguist"
#     COMPLETED_BY_LINGUIST = "Completed_By_Linguist"
#     COMPLETED = "Completed"
#     CANCELLED = "Cancelled"
#     NEW = "New"
#     ASSIGNED = "Assigned"
#     COMPLETED = "Completed"
#     CANCELLED = "Cancelled"
#     ACCEPTED_BY_VENDOR = "Accepted_By_Vendor"
#     DECLINED_BY_VENDOR = "Declined_By_Vendor"
#     COMPLETED_BY_VENDOR = "Completed_By_Vendor"
#     CSV = "CSV"
#     LOG = "LOG"
#     CSV_EXTENDED = "CSV_EXTENDED"
#     XLSX = "XLSX"
#     TBX = "TBX"
#     NEW = "NEW"
#     ACCEPTED = "ACCEPTED"
#     DECLINED = "DECLINED"
#     REJECTED = "REJECTED"
#     DELIVERED = "DELIVERED"
#     EMAILED = "EMAILED"
#     COMPLETED = "COMPLETED"
#     CANCELLED = "CANCELLED"
# CHUNK_SIZE = 1024
# CHAR_SET = "UTF-8"
# TM_THRESHOLD = 0.7
# 
# Path: memsource/models.py
# class BaseModel(dict):
# class User(BaseModel):
# class Authentication(BaseModel):
# class Client(BaseModel):
# class Domain(BaseModel):
# class Language(BaseModel):
# class Project(BaseModel):
# class Job(BaseModel):
# class JobPart(BaseModel):
# class TranslationMemory(BaseModel):
# class AsynchronousRequest(BaseModel):
# class AsynchronousResponse(BaseModel):
# class Segment(BaseModel):
# class SegmentSearchResult(BaseModel):
# class Analysis(BaseModel):
# class MxliffUnit(BaseModel):
# class TermBase(BaseModel):
#     def __getattr__(self, key):
#     def _iso8601_to_datetime(self, source):
#     def date_created(self):
#     def __init__(self, source):
#     def is_complete(self):
#     def has_error(self):
# 
# Path: memsource/api_rest/domain.py
# class Domain(api_rest.BaseApi):
#     # Document: https://cloud.memsource.com/web/docs/api#tag/Domain
# 
#     def create(self, name: str) -> Dict[str, Any]:
#         return self._post("v1/domains", {"name": name})
# 
#     def get(self, domainID: int) -> models.Domain:
#         return models.Domain(self._get("v1/domains/{}".format(domainID)))
# 
#     def list(self, page: int=0) -> List[models.Domain]:
#         domains = self._get("v1/domains", {"page": page})
#         return [models.Domain(domain) for domain in domains.get("content", [])]


# Path: test/api_rest/test_domain.py
import requests
import unittest
from unittest.mock import patch
from memsource import constants, models
from memsource.api_rest.domain import Domain

        self.assertEqual(response, {
            "id": "mock-id",
            "name": "mock-test",
        })

        mock_request.assert_called_with(
            constants.HttpMethod.post.value,
            "https://cloud.memsource.com/web/api2/v1/domains",
            json={"name": "mock-test"},
            params={"token": "mock-token"},
            timeout=60
        )

    @patch.object(requests.Session, "request")
    def test_get(self, mock_request: unittest.mock):
        ms_response = unittest.mock.MagicMock(status_code=200)
        ms_response.json.return_value = {
            "id": "1",
            "name": "1",
        }
        mock_request.return_value = ms_response

        response = Domain(token="mock-token").get(1)
        expected = {
            "name": "1",
            "id": "1",
        }
        self.assertEqual(response, expected)
        self.assertIsInstance(response, models.Domain)
        mock_request.assert_called_with(

            constants.HttpMethod.get.value,