def api_probes_avail(resource_type=None): """ Get available (configured) Probes for this installation, optional for resource type """ probes = views.get_probes_avail(resource_type) return jsonify(probes)
def testProbeViews(self): # All Probes available probes = get_probes_avail() total_probes_count = len(probes) self.assertIsNotNone(probes) self.assertGreater(total_probes_count, 0, 'zero Probes found in app') for probe in probes: plugin_obj = Factory.create_obj(probe) self.assertIsNotNone(plugin_obj, 'Probe create err: %s' % probe) # Probes per Resource Type resource_types = ['OGC:WMS', 'OGC:WFS', 'OGC:CSW', 'OGC:SOS'] for resource_type in resource_types: probes = get_probes_avail(resource_type) self.assertIsNotNone(probes) self.assertGreater( len(probes), 0, 'zero Probes for resource type %s' % resource_type) self.assertGreater( total_probes_count, len(probes), 'total Probes must be greater than for %s' % resource_type) for probe in probes: plugin_obj = Factory.create_obj(probe) self.assertIsNotNone(plugin_obj, 'cannot create Probe for %s' % probe) # Probes per Resource instance resources = Resource.query.all() for resource in resources: probes = get_probes_avail(resource.resource_type, resource) self.assertIsNotNone(probes) self.assertGreater(len(probes), 0, 'zero Probes for resource %s' % resource) for probe in probes: plugin_obj = Factory.create_obj(probe) self.assertIsNotNone(plugin_obj, 'Probe create err: %s' % resource.url)
def api_probes_avail(resource_type=None, resource_id=None): """ Get available (configured) Probes for this installation, optional for resource type """ resource = None if resource_id: resource = views.get_resource_by_id(resource_id) probes = views.get_probes_avail(resource_type=resource_type, resource=resource) return jsonify(probes)
def edit_resource(resource_identifier): """edit a resource""" resource = Resource.query.filter_by(identifier=resource_identifier).first() if resource is None: flash(gettext('Resource not found'), 'danger') return redirect(request.referrer) probes_avail = views.get_probes_avail(resource.resource_type, resource) return render_template('edit_resource.html', lang=g.current_lang, resource=resource, probes_avail=probes_avail)
def edit_resource(resource_identifier): """edit a resource""" resource = Resource.query.filter_by(identifier=resource_identifier).first() if resource is None: flash(gettext('Resource not found'), 'danger') return redirect(request.referrer) probes_avail = views.get_probes_avail(resource.resource_type, resource) suggestions = json.dumps( Recipient.get_suggestions('email', g.user.username)) return render_template('edit_resource.html', lang=g.current_lang, resource=resource, suggestions=suggestions, probes_avail=probes_avail)
def edit_resource(resource_identifier): """edit a resource""" resource = Resource.query.filter_by(identifier=resource_identifier).first() if resource is None: flash(gettext('Resource not found'), 'danger') return redirect(request.referrer) probes_avail = views.get_probes_avail(resource.resource_type, resource) suggestions = json.dumps(Recipient.get_suggestions('email', g.user.username)) return render_template('edit_resource.html', lang=g.current_lang, resource=resource, suggestions=suggestions, probes_avail=probes_avail)