# Path: egasub/ega/entities/run.py
# class Run(object):
#     def __init__(self,alias,sample_id,run_file_type_id,experiment_id,files,_id, status=None, ega_accession_id=None):
#         self.alias = alias
#         self.sample_id = sample_id
#         self.run_file_type_id = run_file_type_id
#         self.experiment_id = experiment_id
#         self.files = files
#         self.id = _id
#         self.status = status
#         self.ega_accession_id = ega_accession_id
# 
#     def to_dict(self):
#         return {
#             'alias' : self.alias,
#             'sampleId' : self.sample_id,
#             'runFileTypeId' : self.run_file_type_id,
#             'experimentId' : self.experiment_id,
#             'files' : map(lambda file: file.to_dict(), self.files),
#             'id' : self.id,
#             'status': self.status,
#             'egaAccessionId': self.ega_accession_id
#             }
# 
# 
#     def to_xml(self):
#         pass
# 
# 
#     @staticmethod
#     def from_dict(run_dict):
#         return Run(
#                 None,
#                 run_dict.get('sampleId'),
#                 run_dict.get('runFileTypeId'),
#                 run_dict.get('experimentId'),
#                 [] if not run_dict.get('files') else [ File.from_dict(file_dict) for file_dict in run_dict.get('files') ],
#                 None
#             )
# 
# Path: egasub/ega/entities/file.py
# class File(object):
#     def __init__(self,file_id,file_name,checksum,unencrypted_checksum,checksum_method):
#         self.file_id = file_id
#         self.file_name = file_name
#         self.checksum = checksum
#         self.unencrypted_checksum = unencrypted_checksum
#         self.checksum_method = checksum_method
# 
#     def to_dict(self):
#         return {
#             'fileId': self.file_id,
#             'fileName': self.file_name,
#             'checksum': self.checksum,
#             'unencryptedChecksum' : self.unencrypted_checksum,
#             'checksumMethod' : self.checksum_method
#         }
# 
#     def to_xml(self):
#         pass
# 
#     @staticmethod
#     def from_dict(file_dict):
#         return File(
#                 None,
#                 file_dict.get('fileName'),
#                 file_dict.get('checksum'),
#                 file_dict.get('unencryptedChecksum'),
#                 file_dict.get('checksumMethod')
#             )


from egasub.ega.entities.run import Run
from egasub.ega.entities.file import File

files = [File(1,'file name 1','checksum1','unencryptedchecksum1','md5'),File(2,'file name 2','checksum2','unencryptedchecksum2','md5')]
run = Run('an alias',3,2,5,files,22)

def test_sample_id():
    assert 3 == run.sample_id

def test_run_file_type_id():
    assert 2 == run.run_file_type_id

def test_experiment_id():
    assert 5 == run.experiment_id

def test_files():
    assert files == run.files

def test_id():

# Path: egasub/ega/entities/run.py
# class Run(object):
#     def __init__(self,alias,sample_id,run_file_type_id,experiment_id,files,_id, status=None, ega_accession_id=None):
#         self.alias = alias
#         self.sample_id = sample_id
#         self.run_file_type_id = run_file_type_id
#         self.experiment_id = experiment_id
#         self.files = files
#         self.id = _id
#         self.status = status
#         self.ega_accession_id = ega_accession_id
# 
#     def to_dict(self):
#         return {
#             'alias' : self.alias,
#             'sampleId' : self.sample_id,
#             'runFileTypeId' : self.run_file_type_id,
#             'experimentId' : self.experiment_id,
#             'files' : map(lambda file: file.to_dict(), self.files),
#             'id' : self.id,
#             'status': self.status,
#             'egaAccessionId': self.ega_accession_id
#             }
# 
# 
#     def to_xml(self):
#         pass
# 
# 
#     @staticmethod
#     def from_dict(run_dict):
#         return Run(
#                 None,
#                 run_dict.get('sampleId'),
#                 run_dict.get('runFileTypeId'),
#                 run_dict.get('experimentId'),
#                 [] if not run_dict.get('files') else [ File.from_dict(file_dict) for file_dict in run_dict.get('files') ],
#                 None
#             )
# 
# Path: egasub/ega/entities/file.py
# class File(object):
#     def __init__(self,file_id,file_name,checksum,unencrypted_checksum,checksum_method):
#         self.file_id = file_id
#         self.file_name = file_name
#         self.checksum = checksum
#         self.unencrypted_checksum = unencrypted_checksum
#         self.checksum_method = checksum_method
# 
#     def to_dict(self):
#         return {
#             'fileId': self.file_id,
#             'fileName': self.file_name,
#             'checksum': self.checksum,
#             'unencryptedChecksum' : self.unencrypted_checksum,
#             'checksumMethod' : self.checksum_method
#         }
# 
#     def to_xml(self):
#         pass
# 
#     @staticmethod
#     def from_dict(file_dict):
#         return File(
#                 None,
#                 file_dict.get('fileName'),
#                 file_dict.get('checksum'),
#                 file_dict.get('unencryptedChecksum'),
#                 file_dict.get('checksumMethod')
#             )


# Path: tests/test_run.py
from egasub.ega.entities.run import Run
from egasub.ega.entities.file import File


files = [File(1,'file name 1','checksum1','unencryptedchecksum1','md5'),File(2,'file name 2','checksum2','unencryptedchecksum2','md5')]
run = Run('an alias',3,2,5,files,22)

def test_sample_id():
    assert 3 == run.sample_id

def test_run_file_type_id():
    assert 2 == run.run_file_type_id

def test_experiment_id():
    assert 5 == run.experiment_id

def test_files():
    assert files == run.files

def test_id():

    assert 22 == run.id