def dissociate_extension(lineid): try: line_extension = line_extension_services.get_by_line_id(lineid) except LineExtensionNotExistsError: raise AssociationNotExistsError("Line with id=%d does not have an extension" % lineid) line_extension_services.dissociate(line_extension) return make_response('', 204)
def get_extension_from_line(lineid): try: line_extension = line_extension_services.get_by_line_id(lineid) except LineExtensionNotExistsError: raise AssociationNotExistsError("Line with id=%d does not have an extension" % lineid) result = formatter.to_api(line_extension) return make_response(result, 200)
def dissociate_extension(lineid): try: line_extension = line_extension_services.get_by_line_id(lineid) except LineExtensionNotExistsError: raise AssociationNotExistsError( "Line with id=%d does not have an extension" % lineid) line_extension_services.dissociate(line_extension) return make_response('', 204)
def get_extension_from_line(lineid): try: line_extension = line_extension_services.get_by_line_id(lineid) except LineExtensionNotExistsError: raise AssociationNotExistsError( "Line with id=%d does not have an extension" % lineid) result = formatter.to_api(line_extension) return make_response(result, 200)
def test_get_by_line_id(self, line_get, dao_get_by_line_id): line = line_get.return_value = Mock(Line, id=1) line_extension = dao_get_by_line_id.return_value = Mock(LineExtension, line_id=line.id) result = line_extension_service.get_by_line_id(line.id) assert_that(result, equal_to(line_extension)) line_get.assert_called_once_with(line.id) dao_get_by_line_id.assert_called_once_with(line.id)
def dissociate_extension(lineid): url.check_line_exists(lineid) line_extension = line_extension_services.get_by_line_id(lineid) line_extension_services.dissociate(line_extension) return make_response('', 204)
def get_extension_from_line(lineid): url.check_line_exists(lineid) line_extension = line_extension_services.get_by_line_id(lineid) result = formatter.to_api(line_extension) return make_response(result, 200)