# Path: i3pystatus/hassio.py
# class Hassio(IntervalModule):
#     def run(self):


import unittest
import json
        import pdb
from mock import patch
from requests import get
from i3pystatus import hassio
          'last_updated': '2021-02-24T23:37:25.627676+00:00',
          'state': 'off'}

HASSIO_URL = 'http://localhost:8123'
FAKETOKEN = 'ihasatoken'


class HassioTest(unittest.TestCase):

    @patch('i3pystatus.hassio.get', autospec=True)
    def test_not_desired_state(self, get):
        """
        Test output when state matches desired state
        """
        hassio.get.return_value.text = json.dumps(STREAM)
        hassiostat = hassio.Hassio(entity_id='asdf1234',
                                   hassio_url=HASSIO_URL,
                                   hassio_token=FAKETOKEN,
                                   good_color="#00FF00",
                                   bad_color="#FF0000",
                                   desired_state='on')
        hassiostat.run()
        self.assertTrue(hassiostat.output == {'full_text': 'Light: off', 'color': '#FF0000'})

    @patch('i3pystatus.hassio.get', autospec=True)
    def test_desired_state(self, urlopen):
        """
        Test output from side-loaded xml (generated from a real hassio server
        response)
        """

# Path: i3pystatus/hassio.py
# class Hassio(IntervalModule):
#     def run(self):


# Path: tests/test_hassio.py
import unittest
import json
        import pdb
from mock import patch
from requests import get
from i3pystatus import hassio

          'last_updated': '2021-02-24T23:37:25.627676+00:00',
          'state': 'off'}

HASSIO_URL = 'http://localhost:8123'
FAKETOKEN = 'ihasatoken'


class HassioTest(unittest.TestCase):

    @patch('i3pystatus.hassio.get', autospec=True)
    def test_not_desired_state(self, get):
        """
        Test output when state matches desired state
        """
        hassio.get.return_value.text = json.dumps(STREAM)
        hassiostat = hassio.Hassio(entity_id='asdf1234',
                                   hassio_url=HASSIO_URL,
                                   hassio_token=FAKETOKEN,
                                   good_color="#00FF00",
                                   bad_color="#FF0000",
                                   desired_state='on')
        hassiostat.run()
        self.assertTrue(hassiostat.output == {'full_text': 'Light: off', 'color': '#FF0000'})

    @patch('i3pystatus.hassio.get', autospec=True)
    def test_desired_state(self, urlopen):
        """
        Test output from side-loaded xml (generated from a real hassio server
        response)
        """

        hassio.get.return_value.text = json.dumps(STREAM)