Exemplo n.º 1
0
def getFacility(name):
    """Return a given facility by name or unique ID.
    @type name: str
    @param name: a facility name or unique ID
    @rtype: Facility
    @return: a facility object
    """
    return Cuebot.getStub('facility').Get(
        facility_pb2.FacilityGetRequest(name=name),
        timeout=Cuebot.Timeout).facility
Exemplo n.º 2
0
    def testGetFacility(self, getStubMock):
        stubMock = mock.Mock()
        stubMock.Get.return_value = facility_pb2.FacilityGetResponse(
            facility=facility_pb2.Facility(name=TEST_FACILITY_NAME))
        getStubMock.return_value = stubMock

        facility = opencue.api.getFacility(TEST_FACILITY_NAME)

        stubMock.Get.assert_called_with(
            facility_pb2.FacilityGetRequest(name=TEST_FACILITY_NAME), timeout=mock.ANY)
        self.assertEqual(TEST_FACILITY_NAME, facility.name)