@@ -0,0 +1,2296 @@
+import unittest%0A%0Afrom cartoframes.data.clients import SQLClient%0Afrom cartoframes.data.observatory.repository.repo_client import RepoClient%0A%0Afrom ..examples import db_dataset1, db_dataset2%0A%0Atry:%0A    from unittest.mock import Mock, patch%0Aexcept ImportError:%0A    from mock import Mock, patch%0A%0A%0Aclass TestRepoClient(unittest.TestCase):%0A%0A    @patch.object(SQLClient, 'query')%0A    def test_run_query_with_one_filter(self, mocked_client):%0A        # Given%0A        mocked_client.return_value = %5Bdb_dataset1, db_dataset2%5D%0A        repo = RepoClient()%0A        query = 'SELECT t.* FROM datasets t'%0A        filters = %7B'category_id': 'demographics'%7D%0A        expected_query = %22SELECT t.* FROM datasets t WHERE t.category_id = 'demographics'%22%0A%0A        # When%0A        categories = repo._run_query(query, filters)%0A%0A        # Then%0A        mocked_client.assert_called_once_with(expected_query)%0A        assert categories == %5Bdb_dataset1, db_dataset2%5D%0A%0A    @patch.object(SQLClient, 'query')%0A    def test_run_query_with_multiple_filter(self, mocked_client):%0A        # Given%0A        mocked_client.return_value = %5Bdb_dataset1, db_dataset2%5D%0A        repo = RepoClient()%0A        query = 'SELECT t.* FROM datasets t'%0A        filters = %7B%0A            'category_id': 'demographics',%0A            'country_id': 'usa'%7D%0A        expected_query = %22SELECT t.* FROM datasets t WHERE t.category_id = 'demographics' AND t.country_id = 'usa'%22%0A%0A        # When%0A        datasets = repo._run_query(query, filters)%0A%0A        # Then%0A        mocked_client.assert_called_once_with(expected_query)%0A        assert datasets == %5Bdb_dataset1, db_dataset2%5D%0A%0A    @patch.object(SQLClient, 'query')%0A    def test_run_query_with_id_list(self, mocked_client):%0A        # Given%0A        mocked_client.return_value = %5Bdb_dataset1, db_dataset2%5D%0A        repo = RepoClient()%0A        query = 'SELECT t.* FROM datasets t'%0A        filters = %7B'id': %5B'carto-do.dataset.census', 'carto-do.dataset.municipalities'%5D%7D%0A        expected_query = %22SELECT t.* FROM datasets t %22 %5C%0A                         %22WHERE t.id IN ('carto-do.dataset.census','carto-do.dataset.municipalities')%22%0A%0A        # When%0A        datasets = repo._run_query(query, filters)%0A%0A        # Then%0A        mocked_client.assert_called_once_with(expected_query)%0A        assert datasets == %5Bdb_dataset1, db_dataset2%5D%0A

Add unit tests for repo client