# Path: solvebio/test/helper.py
# class SolveBioTestCase(unittest.TestCase):
#     TEST_DATASET_FULL_PATH = 'solvebio:public:/HGNC/3.3.0-2020-10-29/HGNC'
#     TEST_DATASET_FULL_PATH_2 = 'solvebio:public:/ClinVar/5.1.0-20200720/Variants-GRCH38'
#     TEST_FILE_FULL_PATH = 'solvebio:public:/HGNC/3.3.0-2020-10-29/hgnc_1000_rows.txt'
# 
#     def setUp(self):
#         super(SolveBioTestCase, self).setUp()
#         api_key = os.environ.get('SOLVEBIO_API_KEY', None)
#         api_host = os.environ.get('SOLVEBIO_API_HOST', None)
#         self.client = solvebio.SolveClient(host=api_host, token=api_key)
# 
#     def check_response(self, response, expect, msg):
#         subset = [(key, response[key]) for
#                   key in [x[0] for x in expect]]
#         self.assertEqual(subset, expect)
# 
#     # Python < 2.7 compatibility
#     def assertRaisesRegexp(self, exception, regexp, callable, *args, **kwargs):
#         try:
#             callable(*args, **kwargs)
#         except exception as err:
#             if regexp is None:
#                 return True
# 
#             if isinstance(regexp, six.string_types):
#                 regexp = re.compile(regexp)
#             if not regexp.search(str(err)):
#                 raise self.failureException('\'%s\' does not match \'%s\'' %
#                                             (regexp.pattern, str(err)))
#         else:
#             raise self.failureException(
#                 '%s was not raised' % (exception.__name__,))


import uuid
from .helper import SolveBioTestCase
        foo_tuple = ('foo', 'bar')

        # foo key-value pair is not in 'metadata' object
        self.assertFalse(foo_tuple in metadata.items())

        metadata['foo'] = 'bar'
        params = folder_no_metadata.serialize(folder_no_metadata)

        # Test that foo key-value pair is set as value to 'metadata'
        # key in 'params' dict that will be serialized
        self.assertTrue(foo_tuple in params['metadata'].items())

        folder_with_metadata = self.client.Object.\
            get_or_create_by_full_path('~/{}'.format(uuid.uuid4()),
                                       object_type='folder',
                                       metadata=dict([foo_tuple]))

        metadata = folder_with_metadata.metadata
        foo_1_tuple = ('foo1', 'bar1')

        # foo_1 key-value pair is not in 'metadata' object
        self.assertFalse(foo_1_tuple in metadata.items())

        metadata['foo1'] = 'bar1'

        params = folder_with_metadata.serialize(folder_with_metadata)
        params_items = params['metadata'].items()

        # Test that both foo and foo_1 key-value pairs are set as value to 'metadata'
        # key in 'params' dict that will be serialized

# Path: solvebio/test/helper.py
# class SolveBioTestCase(unittest.TestCase):
#     TEST_DATASET_FULL_PATH = 'solvebio:public:/HGNC/3.3.0-2020-10-29/HGNC'
#     TEST_DATASET_FULL_PATH_2 = 'solvebio:public:/ClinVar/5.1.0-20200720/Variants-GRCH38'
#     TEST_FILE_FULL_PATH = 'solvebio:public:/HGNC/3.3.0-2020-10-29/hgnc_1000_rows.txt'
# 
#     def setUp(self):
#         super(SolveBioTestCase, self).setUp()
#         api_key = os.environ.get('SOLVEBIO_API_KEY', None)
#         api_host = os.environ.get('SOLVEBIO_API_HOST', None)
#         self.client = solvebio.SolveClient(host=api_host, token=api_key)
# 
#     def check_response(self, response, expect, msg):
#         subset = [(key, response[key]) for
#                   key in [x[0] for x in expect]]
#         self.assertEqual(subset, expect)
# 
#     # Python < 2.7 compatibility
#     def assertRaisesRegexp(self, exception, regexp, callable, *args, **kwargs):
#         try:
#             callable(*args, **kwargs)
#         except exception as err:
#             if regexp is None:
#                 return True
# 
#             if isinstance(regexp, six.string_types):
#                 regexp = re.compile(regexp)
#             if not regexp.search(str(err)):
#                 raise self.failureException('\'%s\' does not match \'%s\'' %
#                                             (regexp.pattern, str(err)))
#         else:
#             raise self.failureException(
#                 '%s was not raised' % (exception.__name__,))


# Path: solvebio/test/test_apiresource.py
import uuid
from .helper import SolveBioTestCase

        foo_tuple = ('foo', 'bar')

        # foo key-value pair is not in 'metadata' object
        self.assertFalse(foo_tuple in metadata.items())

        metadata['foo'] = 'bar'
        params = folder_no_metadata.serialize(folder_no_metadata)

        # Test that foo key-value pair is set as value to 'metadata'
        # key in 'params' dict that will be serialized
        self.assertTrue(foo_tuple in params['metadata'].items())

        folder_with_metadata = self.client.Object.\
            get_or_create_by_full_path('~/{}'.format(uuid.uuid4()),
                                       object_type='folder',
                                       metadata=dict([foo_tuple]))

        metadata = folder_with_metadata.metadata
        foo_1_tuple = ('foo1', 'bar1')

        # foo_1 key-value pair is not in 'metadata' object
        self.assertFalse(foo_1_tuple in metadata.items())

        metadata['foo1'] = 'bar1'

        params = folder_with_metadata.serialize(folder_with_metadata)
        params_items = params['metadata'].items()

        # Test that both foo and foo_1 key-value pairs are set as value to 'metadata'
        # key in 'params' dict that will be serialized

        self.assertTrue(foo_tuple in params_items)