Revision edbed9ce
Added by koszko over 1 year ago
src/test/test_hydrilla_builder.py | ||
---|---|---|
17 | 17 |
from jsonschema import ValidationError |
18 | 18 |
|
19 | 19 |
from hydrilla import util as hydrilla_util |
20 |
from hydrilla.builder import build |
|
20 |
from hydrilla.builder import build, _version
|
|
21 | 21 |
|
22 | 22 |
here = Path(__file__).resolve().parent |
23 | 23 |
|
24 |
expected_generated_by = { |
|
25 |
'name': 'hydrilla.builder', |
|
26 |
'version': _version.version |
|
27 |
} |
|
28 |
|
|
24 | 29 |
default_srcdir = here / 'source-package-example' |
25 | 30 |
|
26 | 31 |
default_js_filenames = ['bye.js', 'hello.js', 'message.js'] |
... | ... | |
57 | 62 |
self.contents = default_contents.copy() |
58 | 63 |
|
59 | 64 |
self.expected_resources = [{ |
60 |
'api_schema_version': [1, 0, 1],
|
|
65 |
'api_schema_version': [1], |
|
61 | 66 |
'source_name': 'hello', |
62 | 67 |
'source_copyright': [{ |
63 | 68 |
'file': 'report.spdx', |
... | ... | |
80 | 85 |
}, { |
81 | 86 |
'file': 'bye.js', |
82 | 87 |
'sha256': self.sha256_hashes['bye.js'] |
83 |
}] |
|
88 |
}], |
|
89 |
'generated_by': expected_generated_by |
|
84 | 90 |
}, { |
85 |
'api_schema_version': [1, 0, 1],
|
|
91 |
'api_schema_version': [1], |
|
86 | 92 |
'source_name': 'hello', |
87 | 93 |
'source_copyright': [{ |
88 | 94 |
'file': 'report.spdx', |
... | ... | |
102 | 108 |
'scripts': [{ |
103 | 109 |
'file': 'message.js', |
104 | 110 |
'sha256': self.sha256_hashes['message.js'] |
105 |
}] |
|
111 |
}], |
|
112 |
'generated_by': expected_generated_by |
|
106 | 113 |
}] |
107 | 114 |
self.expected_mapping = { |
108 |
'api_schema_version': [1, 0, 1],
|
|
115 |
'api_schema_version': [1], |
|
109 | 116 |
'source_name': 'hello', |
110 | 117 |
'source_copyright': [{ |
111 | 118 |
'file': 'report.spdx', |
... | ... | |
127 | 134 |
'https://hachettebugs.koszko.org/***': { |
128 | 135 |
'identifier': 'helloapple' |
129 | 136 |
} |
130 |
} |
|
137 |
}, |
|
138 |
'generated_by': expected_generated_by |
|
131 | 139 |
} |
132 | 140 |
self.expected_source_description = { |
133 |
'api_schema_version': [1, 0, 1],
|
|
141 |
'api_schema_version': [1], |
|
134 | 142 |
'source_name': 'hello', |
135 | 143 |
'source_copyright': [{ |
136 | 144 |
'file': 'report.spdx', |
... | ... | |
160 | 168 |
'identifier': 'helloapple', |
161 | 169 |
'long_name': 'Hello Apple', |
162 | 170 |
'version': [2021, 11, 10], |
163 |
}] |
|
171 |
}], |
|
172 |
'generated_by': expected_generated_by |
|
164 | 173 |
} |
165 | 174 |
|
166 | 175 |
def expected(self) -> list[dict]: |
Also available in: Unified diff
when generating JSON documents, put generating software info in 'generated_by' property