# Path: ethronsoft/gcspypi/exceptions/repository_errors.py
# class RepositoryError(Exception):
#     pass
# 
# Path: ethronsoft/gcspypi/exceptions/boundary_errors.py
# class NotFound(Exception):
#     pass
# 
# Path: ethronsoft/gcspypi/repository/object_metadata.py
# class ObjectMetadata(object):
#     """ObjectMetadata represents the metadata associated with a repository Object
#     """
# 
#     def __init__(self, mime, md5_hash, time_created):
#         """ObjectMetadata constructor
#         
#         Arguments:
#             mime {str} -- MIME type of object
#             md5_hash {str} -- Hash representing the object. Can be used to determine content equality
#             time_created {datetime} -- Timestamp for the object creation
#         """
# 
#         self.mime = mime
#         self.md5 = md5_hash
#         self.time_created = time_created


from ethronsoft.gcspypi.exceptions import RepositoryError, NotFound
from ethronsoft.gcspypi.repository.object_metadata import ObjectMetadata
import hashlib
import datetime
    return ObjectMetadata(content_type, hashlib.md5(content).hexdigest(), datetime.datetime.now())

class MockRepository(object):
    
    def __init__(self):
        self.name = "mock_repo"
        self._repository = {

        }

    def upload_content(self, object_name, content, content_type="text/plain"):
       self._repository[object_name] = {
           "content": content,
           "metadata": _make_metadata(content.encode("utf-8"), content_type)
       }

    def upload_file(self,object_name, file_obj):
        cnt = file_obj.read()
        self._repository[object_name] = {
           "content": cnt,
           "metadata": _make_metadata(cnt, "application/octet-stream")
        }

    def download_content(self, object_name):
        if not self.exists(object_name):
            raise NotFound()
        return self._repository[object_name]["content"]

    def download_file(self, object_name, file_obj):
        if not self.exists(object_name):

# Path: ethronsoft/gcspypi/exceptions/repository_errors.py
# class RepositoryError(Exception):
#     pass
# 
# Path: ethronsoft/gcspypi/exceptions/boundary_errors.py
# class NotFound(Exception):
#     pass
# 
# Path: ethronsoft/gcspypi/repository/object_metadata.py
# class ObjectMetadata(object):
#     """ObjectMetadata represents the metadata associated with a repository Object
#     """
# 
#     def __init__(self, mime, md5_hash, time_created):
#         """ObjectMetadata constructor
#         
#         Arguments:
#             mime {str} -- MIME type of object
#             md5_hash {str} -- Hash representing the object. Can be used to determine content equality
#             time_created {datetime} -- Timestamp for the object creation
#         """
# 
#         self.mime = mime
#         self.md5 = md5_hash
#         self.time_created = time_created


# Path: test/mocks/mock_repository.py
from ethronsoft.gcspypi.exceptions import RepositoryError, NotFound
from ethronsoft.gcspypi.repository.object_metadata import ObjectMetadata
import hashlib
import datetime

    return ObjectMetadata(content_type, hashlib.md5(content).hexdigest(), datetime.datetime.now())

class MockRepository(object):
    
    def __init__(self):
        self.name = "mock_repo"
        self._repository = {

        }

    def upload_content(self, object_name, content, content_type="text/plain"):
       self._repository[object_name] = {
           "content": content,
           "metadata": _make_metadata(content.encode("utf-8"), content_type)
       }

    def upload_file(self,object_name, file_obj):
        cnt = file_obj.read()
        self._repository[object_name] = {
           "content": cnt,
           "metadata": _make_metadata(cnt, "application/octet-stream")
        }

    def download_content(self, object_name):
        if not self.exists(object_name):
            raise NotFound()
        return self._repository[object_name]["content"]

    def download_file(self, object_name, file_obj):
        if not self.exists(object_name):

            raise NotFound()