# Path: zaqarclient/tests/queues/base.py
# MY_IP = netutils.get_my_ipv4()
# class QueuesTestBase(base.TestBase):
#     def setUp(self):
# 
# Path: zaqarclient/transport/response.py
# class Response(object):
#     def __init__(self, request, content, headers=None, status_code=None):
#     def deserialized_content(self):


import json
import mock
from zaqarclient.tests.queues import base
from zaqarclient.transport import response
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.




class QueuesV2HealthUnitTest(base.QueuesTestBase):

    def test_health(self):
        expect_health = {u'catalog_reachable': True,
                         u'redis': {u'operation_status': {},
                                    u'storage_reachable': True}
                         }

        with mock.patch.object(self.transport, 'send',
                               autospec=True) as send_method:

            health_content = json.dumps(expect_health)
            health_resp = response.Response(None, health_content)
            send_method.side_effect = iter([health_resp])

            health = self.client.health()
            self.assertEqual(expect_health, health)



# Path: zaqarclient/tests/queues/base.py
# MY_IP = netutils.get_my_ipv4()
# class QueuesTestBase(base.TestBase):
#     def setUp(self):
# 
# Path: zaqarclient/transport/response.py
# class Response(object):
#     def __init__(self, request, content, headers=None, status_code=None):
#     def deserialized_content(self):


# Path: zaqarclient/tests/queues/health.py
import json
import mock
from zaqarclient.tests.queues import base
from zaqarclient.transport import response

#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.




class QueuesV2HealthUnitTest(base.QueuesTestBase):

    def test_health(self):
        expect_health = {u'catalog_reachable': True,
                         u'redis': {u'operation_status': {},
                                    u'storage_reachable': True}
                         }

        with mock.patch.object(self.transport, 'send',
                               autospec=True) as send_method:

            health_content = json.dumps(expect_health)
            health_resp = response.Response(None, health_content)
            send_method.side_effect = iter([health_resp])

            health = self.client.health()
            self.assertEqual(expect_health, health)



class QueuesV2HealthFunctionalTest(base.QueuesTestBase):