def findGroup(show, group): """Returns a group object. :type show: str :param show: the name of a show :type group: str :param group: the name of a group :rtype: Group :return: the matching group object""" return Group(Cuebot.getStub('group').FindGroup( job_pb2.GroupFindGroupRequest(show=show, name=group), timeout=Cuebot.Timeout).group)
def testFindGroup(self, getStubMock): stubMock = mock.Mock() stubMock.FindGroup.return_value = job_pb2.GroupFindGroupResponse( group=job_pb2.Group(name=TEST_GROUP_NAME)) getStubMock.return_value = stubMock group = opencue.api.findGroup(TEST_SHOW_NAME, TEST_GROUP_NAME) stubMock.FindGroup.assert_called_with( job_pb2.GroupFindGroupRequest( show=TEST_SHOW_NAME, name=TEST_GROUP_NAME), timeout=mock.ANY) self.assertEqual(TEST_GROUP_NAME, group.name())