Exemplo n.º 1
0
 def test_missing_optional_value(self):
     """ Test to ensure missing optional value is acceptable """
     embark_field_definitions = json.loads(
         '{"xpath": "./group[@id=\'object_00080\']' +
         '/variable[@id=\'object_00080\']"}')
     starts_with = get_json_value(embark_field_definitions, 'startsWith',
                                  False)
     self.assertTrue(starts_with == "")
Exemplo n.º 2
0
 def test_get_optional_value(self):
     """ Test process of getting an optional value """
     embark_field_definitions = json.loads(
         '{"xpath": "./group[@id=\'object_00080\']' +
         '/variable[@id=\'object_00080\']","startsWith": "AAT:"}')
     starts_with = get_json_value(embark_field_definitions, 'startsWith',
                                  False)
     self.assertTrue(starts_with == "AAT:")
Exemplo n.º 3
0
def get_item_xpath(embark_field_definitions):
    """ Return Item XPath defining Item location in EmbArk XML """
    return get_json_value(embark_field_definitions, 'itemPath')
Exemplo n.º 4
0
def get_constant(embark_field_definition):
    """ Returns constant to include in JSON output (e.g. Repository) """
    return get_json_value(embark_field_definition, 'constant', False)
Exemplo n.º 5
0
def get_validation_rule(embark_field_definition):
    """ Returns type of Validation to enforce """
    return get_json_value(embark_field_definition, 'validation', False)
Exemplo n.º 6
0
def get_starts_with(embark_field_definition):
    """ Returns string to test Starts With """
    return get_json_value(embark_field_definition, 'startsWith', False)
Exemplo n.º 7
0
def get_does_not_start_with(embark_field_definition):
    """ Returns string to test Does Not Start With """
    return get_json_value(embark_field_definition, 'doesNotStartWith', False)
Exemplo n.º 8
0
def get_field_default(embark_field_definition):
    """ Return the default value to use if value not present in EmbArk xml """
    return get_json_value(embark_field_definition, 'default', False)
Exemplo n.º 9
0
def get_field_xpath(embark_field_definition):
    """ Return the xpath where we can find this field in EmbArk xml """
    return get_json_value(embark_field_definition, 'xpath')
Exemplo n.º 10
0
def get_field_duplicates_allowed(embark_field_definition):
    """ Return boolean whether duplicates are allowed """
    return get_json_value(embark_field_definition, 'duplicatesAllowed')
Exemplo n.º 11
0
def get_field_required(embark_field_definition):
    """ Return boolean whether field is required or not """
    return get_json_value(embark_field_definition, 'required')
Exemplo n.º 12
0
def get_field_name(embark_field_definition):
    """ Return name of field """
    return get_json_value(embark_field_definition, 'name')
Exemplo n.º 13
0
def get_fields_definition(embark_field_definitions):
    """ Return Field Definitions from embark_xml_fields.json """
    return get_json_value(embark_field_definitions, 'FieldsToExtract')
Exemplo n.º 14
0
 def test_get_required_value(self):
     """ Test getting a required value """
     original_path = '{"itemPath": "./Section[@name=\'Body\'][@id=\'section_07\']","FieldsToExtract": []}'
     embark_field_definitions = json.loads(original_path)
     item_xpath = get_json_value(embark_field_definitions, 'itemPath')
     self.assertTrue(item_xpath == embark_field_definitions['itemPath'])