def getActiveShows(): """Returns a list of all active shows. @rtype: list<Show> @return: a List of show objects""" showSeq = Cuebot.getStub('show').GetActiveShows( show_pb2.ShowGetActiveShowsRequest(), timeout=Cuebot.Timeout).shows return [Show(s) for s in showSeq.shows]
def testGetActiveShows(self, getStubMock): show1Name = 'first-show' show2Name = 'second-show' stubMock = mock.Mock() stubMock.GetActiveShows.return_value = show_pb2.ShowGetActiveShowsResponse( shows=show_pb2.ShowSeq( shows=[show_pb2.Show(name=show1Name), show_pb2.Show(name=show2Name)])) getStubMock.return_value = stubMock showList = opencue.api.getActiveShows() stubMock.GetActiveShows.assert_called_with( show_pb2.ShowGetActiveShowsRequest(), timeout=mock.ANY) self.assertEqual([show1Name, show2Name], [show.name() for show in showList])