示例#1
0
文件: views.py 项目: Normation/ncf
def delete_technique(bundle_name):
  try:
    path = get_path_from_args(request)
    ncf.delete_technique(bundle_name,path)
    return jsonify({ "data": { "bundle_name" : bundle_name } })
  except Exception as e:
    return format_error(e, "technique deletion", 500)
示例#2
0
def delete_technique(bundle_name):
    try:
        path = get_path_from_args(request)
        ncf.delete_technique(bundle_name, path)
        return jsonify({"data": {"bundle_name": bundle_name}})
    except Exception as e:
        return format_error(e, "technique deletion", 500)
示例#3
0
 def test_delete_technique(self):
   """Check if a technique file is correctly deleted"""
   ncf.write_technique(self.technique_metadata, os.path.realpath("write_test"))
   ncf.delete_technique(self.technique_metadata['bundle_name'], os.path.realpath("write_test"))
   result = not os.path.exists(os.path.realpath(os.path.join("write_test", "50_techniques", self.technique_metadata['bundle_name'])))
   # Clean
   shutil.rmtree(os.path.realpath(os.path.join("write_test", "50_techniques")))
   self.assertTrue(result)
示例#4
0
文件: views.py 项目: fanf/ncf
def delete_technique(bundle_name):
    
  if "path" in request.args:
    path = request.args['path']
  else:
    path = ""

  try:
    ncf.delete_technique(bundle_name,path)
  except ncf.NcfError, ex:
    return jsonify( { 'error' : ex.message } ), 500
示例#5
0
文件: test_ncf.py 项目: DINKIN/ncf
 def test_delete_technique(self):
     """Check if a technique file is correctly deleted"""
     ncf.write_technique(self.technique_metadata,
                         os.path.realpath("write_test"))
     ncf.delete_technique(self.technique_metadata['bundle_name'],
                          os.path.realpath("write_test"))
     result = not os.path.exists(
         os.path.realpath(
             os.path.join("write_test", "50_techniques",
                          self.technique_metadata['bundle_name'])))
     # Clean
     shutil.rmtree(
         os.path.realpath(os.path.join("write_test", "50_techniques")))
     self.assertTrue(result)