# 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/client_mocks.py
# def fake_object_create(*args, **kwargs):
#     return FakeObjectResponse(kwargs).create()
# 
# def fake_object_save(*args, **kwargs):
#     return FakeObjectResponse(kwargs).save()
# 
# Path: solvebio/test/client_mocks.py
# def fake_dataset_create(*args, **kwargs):
#     # Dataset.create() is deprecated
#     print("WARNING: Your code likely wants to be using FakeObjectCreate.")
#     return FakeDatasetResponse(kwargs).create()


import uuid
import mock
from .helper import SolveBioTestCase
from solvebio.test.client_mocks import fake_object_create, fake_object_save
from solvebio.test.client_mocks import fake_dataset_create
        from .. import SolveClient
        expected = 'acme:myVault:/foo/bar/baz'
        self.assertEqual(p, expected)

        case = '~/folder'
        p, _ = self.client.Object.validate_full_path(case, path='foo/bar/baz')
        expected = '{0}:/foo/bar/baz'.format(user_vault)
        self.assertEqual(p, expected)

    @mock.patch('solvebio.resource.Object.create')
    def test_object_has_tag(self, ObjectMock):
        ObjectMock.side_effect = fake_object_create

        tags = ["foo", "bar", "BIZ"]
        obj = self.client.Object.create(name='blah', tags=tags)
        self.assertEqual(obj.tags, tags)
        self.assertTrue(obj.has_tag("FOO"))
        self.assertTrue(obj.has_tag("foo"))
        self.assertTrue(obj.has_tag("BAr"))
        self.assertTrue(obj.has_tag("BAr"))
        self.assertTrue(obj.has_tag("biz"))
        self.assertFalse(obj.has_tag("BAz"))
        self.assertFalse(obj.has_tag("baz"))

        obj = self.client.Object.create(name='blah_untagged')
        self.assertEqual(obj.tags, [])
        self.assertFalse(obj.has_tag("foo"))

    @mock.patch('solvebio.resource.Dataset.create')
    @mock.patch('solvebio.resource.Object.create')
    def test_object_dataset_getattr(self, ObjectCreate, DatasetCreate):

# 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/client_mocks.py
# def fake_object_create(*args, **kwargs):
#     return FakeObjectResponse(kwargs).create()
# 
# def fake_object_save(*args, **kwargs):
#     return FakeObjectResponse(kwargs).save()
# 
# Path: solvebio/test/client_mocks.py
# def fake_dataset_create(*args, **kwargs):
#     # Dataset.create() is deprecated
#     print("WARNING: Your code likely wants to be using FakeObjectCreate.")
#     return FakeDatasetResponse(kwargs).create()


# Path: solvebio/test/test_object.py
import uuid
import mock
from .helper import SolveBioTestCase
from solvebio.test.client_mocks import fake_object_create, fake_object_save
from solvebio.test.client_mocks import fake_dataset_create
        from .. import SolveClient

        expected = 'acme:myVault:/foo/bar/baz'
        self.assertEqual(p, expected)

        case = '~/folder'
        p, _ = self.client.Object.validate_full_path(case, path='foo/bar/baz')
        expected = '{0}:/foo/bar/baz'.format(user_vault)
        self.assertEqual(p, expected)

    @mock.patch('solvebio.resource.Object.create')
    def test_object_has_tag(self, ObjectMock):
        ObjectMock.side_effect = fake_object_create

        tags = ["foo", "bar", "BIZ"]
        obj = self.client.Object.create(name='blah', tags=tags)
        self.assertEqual(obj.tags, tags)
        self.assertTrue(obj.has_tag("FOO"))
        self.assertTrue(obj.has_tag("foo"))
        self.assertTrue(obj.has_tag("BAr"))
        self.assertTrue(obj.has_tag("BAr"))
        self.assertTrue(obj.has_tag("biz"))
        self.assertFalse(obj.has_tag("BAz"))
        self.assertFalse(obj.has_tag("baz"))

        obj = self.client.Object.create(name='blah_untagged')
        self.assertEqual(obj.tags, [])
        self.assertFalse(obj.has_tag("foo"))

    @mock.patch('solvebio.resource.Dataset.create')
    @mock.patch('solvebio.resource.Object.create')
    def test_object_dataset_getattr(self, ObjectCreate, DatasetCreate):

        ObjectCreate.side_effect = fake_object_create