def setDepartment(self, name): """Sets the group's department to the specified name. The department name must be one of the allowed department names. All jobs in the group will inherit the new department name. See AdminStatic for getting a list of allowed department names. Department names are maintained by the middle-tier group. @type name: string @param name: a valid department name""" self.stub.SetDepartment(job_pb2.GroupSetDeptRequest(group=self.data, dept=name), timeout=Cuebot.Timeout) self.data.department = name
def setDepartment(self, name): """Sets the group's department to the specified name. The department name must be one of the allowed department names. All jobs in the group will inherit the new department name. :type name: string :param name: a valid department name """ self.stub.SetDepartment(job_pb2.GroupSetDeptRequest(group=self.data, dept=name), timeout=Cuebot.Timeout) self.data.department = name
def testSetDepartment(self, getStubMock): stubMock = mock.Mock() stubMock.SetDepartment.return_value = job_pb2.GroupSetDeptResponse() getStubMock.return_value = stubMock dept = 'pipeline' group = opencue.wrappers.group.Group( job_pb2.Group(name=TEST_GROUP_NAME)) group.setDepartment(dept) expected = job_pb2.Group(name=TEST_GROUP_NAME) stubMock.SetDepartment.assert_called_with( job_pb2.GroupSetDeptRequest(group=expected, dept=dept), timeout=mock.ANY)