Project

General

Profile

« Previous | Next » 

Revision a066af01

Added by koszko over 1 year ago

include $schema property in internally-generated resources/mappings

View differences:

html/payload_create.js
97 97
    const sha256 = compute_sha256(script);
98 98

  
99 99
    const resource = {
100
	$schema: "https://hydrilla.koszko.org/schemas/api_resource_description-1.0.1.schema.json",
100 101
	source_name: identifier,
101 102
	source_copyright: [],
102 103
	type: "resource",
......
104 105
	long_name,
105 106
	uuid: uuidv4(),
106 107
	version: [1],
108
	revision: 1,
107 109
	description,
108 110
	dependencies: [],
109 111
	scripts: [{file: "payload.js", sha256}]
110 112
    };
111 113

  
112 114
    const mapping = {
115
	$schema: "https://hydrilla.koszko.org/schemas/api_mapping_description-1.0.1.schema.json",
113 116
	source_name: identifier,
114 117
	source_copyright: [],
115 118
	type: "mapping",
test/haketilo_test/unit/test_payload_create.py
45 45
    'script':      sample_files['hello.js']['contents']
46 46
}
47 47

  
48
resource_schema_id, mapping_schema_id = [
49
    f'https://hydrilla.koszko.org/schemas/api_{t}_description-1.0.1.schema.json'
50
    for t in ('resource', 'mapping')
51
]
52

  
48 53
def fill_form_with_sample_data(execute_in_page, sample_data_override={},
49 54
                               form_ctx='form_ctx'):
50 55
    form_data = sample_form_data.copy()
......
128 133
                         for pat in form_data['patterns'].split('\n') if pat])
129 134

  
130 135
        assert db_contents['resource'] == [{
136
            '$schema':          resource_schema_id,
131 137
      	    'source_name':      localid,
132 138
	    'source_copyright': [],
133 139
	    'type':             'resource',
134 140
	    'identifier':       localid,
135 141
	    'uuid':             db_contents['resource'][0]['uuid'],
136 142
	    'version':          [1],
143
            'revision':         1,
137 144
	    'description':      form_data['description'],
138 145
	    'dependencies':     [],
139 146
            'long_name':        long_name,
......
145 152

  
146 153
        assert uuidv4_re.match(db_contents['mapping'][0]['uuid'])
147 154
        assert db_contents['mapping'] == [{
155
            '$schema':          mapping_schema_id,
148 156
      	    'source_name':      localid,
149 157
	    'source_copyright': [],
150 158
	    'type':             'mapping',

Also available in: Unified diff