예제 #1
0
def initialize_sanitized_properties(
    context, resource_type, resource_name, properties):
  properties = properties.split(',')
  properties = dict([(p.strip(), '<script>foo</script>') for p in properties])
  print properties
  handle_named_example_resource(
      context, resource_type, resource_name, **properties)
예제 #2
0
def initialize_sanitized_properties(
    context, resource_type, resource_name, properties):
  properties = properties.split(',')
  properties = dict([
      (p.strip(), '<script>foo{}</script>'.format(resource_type))
      for p in properties
      ])
  handle_named_example_resource(
      context, resource_type, resource_name, **properties)
예제 #3
0
def post_collection_of_resources(context):
    """Iterate over a table where the first two columns are `type` and `name`.
  Successive columns are for properties to be set on the resource before
  posting it to the relevant collection.
  """
    for row in context.table:
        resource_type = row[0]
        name = row[1]
        properties = dict([(heading, row[heading]) for heading in row.headings[2:]])
        handle_named_example_resource(context, resource_type, name, **properties)
        handle_post_named_example(context, name)
        handle_get_example_resource(context, name)
예제 #4
0
def post_collection_of_resources(context):
    """Iterate over a table where the first two columns are `type` and `name`.
  Successive columns are for properties to be set on the resource before
  posting it to the relevant collection.
  """
    for row in context.table:
        resource_type = row[0]
        name = row[1]
        properties = dict([(heading, row[heading])
                           for heading in row.headings[2:]])
        handle_named_example_resource(context, resource_type, name,
                                      **properties)
        handle_post_named_example(context, name)
        handle_get_example_resource(context, name)
예제 #5
0
def create_category(context, name, category_type):
    handle_named_example_resource(context,
                                  'Category',
                                  name,
                                  type=category_type)
예제 #6
0
def create_option(context, name, role):
    handle_named_example_resource(context, 'Option', name, role=role)
예제 #7
0
def named_example_resource(context, resource_type, example_name, **kwargs):
    handle_named_example_resource(context, resource_type, example_name,
                                  **kwargs)
예제 #8
0
def named_example_from_json(context, resource_type, example_name):
    text = handle_template_text(context, context.text)
    json_obj = json.loads(text)
    handle_named_example_resource(context, resource_type, example_name,
                                  **json_obj)
예제 #9
0
def create_option(context, name, role):
    handle_named_example_resource(context, "Option", name, role=role)
예제 #10
0
파일: http_.py 프로젝트: gaurav46/ggrc-core
def create_role_from_json(context, role_name):
    json_obj = json.loads(context.text)
    handle_named_example_resource(context, Role, role_name, **json_obj)
예제 #11
0
def named_example_resource(context, resource_type, example_name, **kwargs):
  handle_named_example_resource(context, resource_type, example_name, **kwargs)
예제 #12
0
def named_example_from_json(context, resource_type, example_name):
  text = handle_template_text(context, context.text)
  json_obj = json.loads(text)
  handle_named_example_resource(
      context, resource_type, example_name, **json_obj)
예제 #13
0
def create_category(context, name, scope):
  handle_named_example_resource(context, 'Category', name, scope_id=int(scope))
예제 #14
0
def create_role_from_json(context, role_name):
  json_obj = json.loads(context.text)
  handle_named_example_resource(context, Role, role_name, **json_obj)