Beispiel #1
0
class TestSnapstream(unittest.TestCase):

    def setUp(self):
        data = {
            'id': 'test',
            'status': 'playing',
            'uri': {
                'query': {
                    'name': ''
                }
            }
        }
        self.stream = Snapstream(data)

    def test_init(self):
        self.assertEqual(self.stream.identifier, 'test')
        self.assertEqual(self.stream.status, 'playing')
        self.assertEqual(self.stream.name, '')
        self.assertEqual(self.stream.friendly_name, 'test')

    def test_update(self):
        self.stream.update({
            'id': 'test',
            'status': 'idle'
        })
        self.assertEqual(self.stream.status, 'idle')
Beispiel #2
0
 def setUp(self):
     data = {
         'id': 'test',
         'status': 'playing',
         'uri': {
             'query': {
                 'name': ''
             }
         }
     }
     self.stream = Snapstream(data)
Beispiel #3
0
 def synchronize(self, status):
     """Synchronize snapserver."""
     self._version = status.get('server').get('version')
     self._groups = {}
     self._clients = {}
     self._streams = {}
     for stream in status.get('server').get('streams'):
         self._streams[stream.get('id')] = Snapstream(stream)
         _LOGGER.debug('stream found: %s', self._streams[stream.get('id')])
     for group in status.get('server').get('groups'):
         self._groups[group.get('id')] = Snapgroup(self, group)
         _LOGGER.debug('group found: %s', self._groups[group.get('id')])
         for client in group.get('clients'):
             self._clients[client.get('id')] = Snapclient(self, client)
             _LOGGER.debug('client found: %s', self._clients[client.get('id')])