def setUp(self):
     """Set up the test case."""
     self.monoprice = MockMonoprice()
     self.hass = tests.common.get_test_home_assistant()
     self.hass.start()
     # Note, source dictionary is unsorted!
     with mock.patch('pymonoprice.get_monoprice',
                     new=lambda *a: self.monoprice):
         setup_platform(
             self.hass, {
                 'platform': 'monoprice',
                 'port': '/dev/ttyS0',
                 'name': 'Name',
                 'zones': {
                     12: {
                         'name': 'Zone name'
                     }
                 },
                 'sources': {
                     1: {
                         'name': 'one'
                     },
                     3: {
                         'name': 'three'
                     },
                     2: {
                         'name': 'two'
                     }
                 },
             }, lambda *args, **kwargs: None, {})
         self.hass.block_till_done()
     self.media_player = self.hass.data[DATA_MONOPRICE][0]
     self.media_player.hass = self.hass
     self.media_player.entity_id = 'media_player.zone_1'
Exemplo n.º 2
0
 def setUp(self):
     """Set up the test case."""
     self.monoprice = MockMonoprice()
     self.hass = tests.common.get_test_home_assistant()
     self.hass.start()
     # Note, source dictionary is unsorted!
     with mock.patch('pymonoprice.get_monoprice',
                     new=lambda *a: self.monoprice):
         setup_platform(self.hass, {
             'platform': 'monoprice',
             'port': '/dev/ttyS0',
             'name': 'Name',
             'zones': {12: {'name': 'Zone name'}},
             'sources': {1: {'name': 'one'},
                         3: {'name': 'three'},
                         2: {'name': 'two'}},
         }, lambda *args, **kwargs: None, {})
         self.hass.block_till_done()
     self.media_player = self.hass.data[DATA_MONOPRICE][0]
     self.media_player.hass = self.hass
     self.media_player.entity_id = 'media_player.zone_1'