import os
import unittest
from nefit import NefitClient, NefitResponseException


class ClientTest(unittest.TestCase):
    def test_exceptions(self):
        client = NefitClient(
            os.environ.get("NEFIT_SERIAL", 123456789),
            os.environ.get("NEFIT_ACCESS_KEY", "abc1abc2abc3abc4"),
            "asddasadsasdcx"
        )
        client.connect()
        with self.assertRaises(NefitResponseException):
            client.get_display_code()
        client.disconnect()
        client.force_disconnect()


if __name__ == '__main__':
    unittest.main()

[((21, 4, 21, 19), 'unittest.main', 'unittest.main', ({}, {}), '()', False, 'import unittest\n'), ((9, 12, 9, 53), 'os.environ.get', 'os.environ.get', ({(9, 27, 9, 41): '"""NEFIT_SERIAL"""', (9, 43, 9, 52): '123456789'}, {}), "('NEFIT_SERIAL', 123456789)", False, 'import os\n'), ((10, 12, 10, 66), 'os.environ.get', 'os.environ.get', ({(10, 27, 10, 45): '"""NEFIT_ACCESS_KEY"""', (10, 47, 10, 65): '"""abc1abc2abc3abc4"""'}, {}), "('NEFIT_ACCESS_KEY', 'abc1abc2abc3abc4')", False, 'import os\n')]