140 self.assertEquals(impl.outputs[0].inputs[0].include['files'],['test/override.txt, test/s60.txt']) |
138 self.assertEquals(impl.outputs[0].inputs[0].include['files'],['test/override.txt, test/s60.txt']) |
141 |
139 |
142 def test_configuration_content_get_full_copy_list(self): |
140 def test_configuration_content_get_full_copy_list(self): |
143 impl = self.load_impl('assets/s60/implml/copy_files.content') |
141 impl = self.load_impl('assets/s60/implml/copy_files.content') |
144 files = impl.get_full_copy_list() |
142 files = impl.get_full_copy_list() |
145 self.assertEquals(files[0],('family/content/test/override.txt', 'output/content/test/override.txt', False)) |
143 self.assertEquals(files, |
|
144 [('assets/s60/content/test/s60.txt', 'content/test/s60.txt', False), |
|
145 ('family/content/test/override.txt', 'content/test/override.txt', False)]) |
146 |
146 |
147 def test_configuration_content_list_output_files(self): |
147 def test_configuration_content_list_output_files(self): |
148 config = self.load_config() |
148 config = self.load_config() |
149 impls = plugin.get_impl_set(config,'\.content$') |
149 impls = plugin.get_impl_set(config,'\.content$') |
150 impls.output = self.output |
|
151 files = impls.list_output_files() |
150 files = impls.list_output_files() |
152 self.assertTrue('output/content/test/override.txt' in files) |
151 self.assertTrue('content/test/override.txt' in files) |
153 |
152 |
154 def test_configuration_content_list_output_files_with_refs_filter(self): |
153 def test_configuration_content_list_output_files_with_refs_filter(self): |
155 impl = self.load_impl('assets/s60/implml/test_content_with_sequence_refs.content') |
154 impl = self.load_impl('assets/s60/implml/test_content_with_sequence_refs.content') |
156 files = impl.list_output_files() |
155 files = impl.list_output_files() |
157 self.assertEquals(files[0],'output/content/override.txt') |
156 self.assertEquals(files[0],'content/override.txt') |
158 |
157 |
159 def test_configuration_content_list_output_files_with_exclude_filter(self): |
158 def test_configuration_content_list_output_files_with_exclude_filter(self): |
160 impl = self.load_impl('assets/s60/implml/test_filter_both.content') |
159 impl = self.load_impl('assets/s60/implml/test_filter_both.content') |
161 files = impl.list_output_files() |
160 files = impl.list_output_files() |
162 self.assertEquals(files[0],'output/content/prodX/jee/ProdX_specific.txt') |
161 self.assertEquals(files[0],'content/prodX/jee/ProdX_specific.txt') |
163 # |
162 # |
164 def test_configuration_get_input_with_ref(self): |
163 def test_configuration_get_input_with_ref(self): |
165 impl = self.load_impl('assets/s60/implml/test_content_with_refs.content') |
164 impl = self.load_impl('assets/s60/implml/test_content_with_refs.content') |
166 self.assertEquals(impl.outputs[0].dir, 'content') |
165 self.assertEquals(impl.outputs[0].dir, 'content') |
167 self.assertEquals(impl.outputs[0].inputs[0].dir, 'content') |
166 self.assertEquals(impl.outputs[0].inputs[0].dir, 'content') |
168 |
167 |
169 def test_configuration_get_include_with_refs(self): |
168 def test_configuration_get_include_with_refs(self): |
170 impl = self.load_impl('assets/s60/implml/test_content_with_sequence_refs.content') |
169 impl = self.load_impl('assets/s60/implml/test_content_with_sequence_refs.content') |
171 self.assertEquals(impl.outputs[0].inputs[0].include['files'], ['test/override.txt']) |
170 self.assertEquals(impl.outputs[0].inputs[0].include['files'], ['test/override.txt']) |
172 self.assertEquals(impl.list_output_files(), ['output/content/override.txt']) |
171 self.assertEquals(impl.list_output_files(), ['content/override.txt']) |
173 |
172 |
174 def test_configuration_get_include_with_refs(self): |
173 def test_configuration_get_include_with_refs2(self): |
175 impl = self.load_impl('assets/s60/implml/copy.content') |
174 impl = self.load_impl('assets/s60/implml/copy.content') |
176 expected = ['output/content/prodX/jee/ProdX_specific.txt', |
175 expected = ['content/prodX/jee/ProdX_specific.txt', |
177 'output/content/test/shout.txt', |
176 'content/test/shout.txt', |
178 'output/content/test/override.txt', |
177 'content/test/override.txt', |
179 'output/content/test/s60.txt', |
178 'content/test/s60.txt', |
180 'output/content/test/test_CAP_letters.txt'] |
179 'content/test/test_CAP_letters.txt'] |
181 actual = impl.list_output_files() |
180 actual = impl.list_output_files() |
182 self.assertEquals(sorted(actual), sorted(expected)) |
181 self.assertEquals(sorted(actual), sorted(expected)) |
183 |
182 |
184 def test_configuration_content_create_output(self): |
183 def test_configuration_content_create_output(self): |
185 impl = self.load_impl('assets/s60/implml/copy.content') |
184 impl = self.load_impl('assets/s60/implml/copy.content') |
186 impl.set_output_root(self.output) |
|
187 impl.logger.setLevel(logging.DEBUG) |
185 impl.logger.setLevel(logging.DEBUG) |
188 impl.create_output() |
186 impl.create_output() |
189 self.assertTrue(os.path.exists(impl.output)) |
187 self.assertTrue(os.path.exists(os.path.join(self.output,'content/prodX/jee/ProdX_specific.txt'))) |
190 self.assertTrue(os.path.exists(os.path.join(impl.output,'content/prodX/jee/ProdX_specific.txt'))) |
|
191 |
188 |
192 def test_configuration_content_generate(self): |
189 def test_configuration_content_generate(self): |
193 config = self.load_config() |
190 config = self.load_config() |
194 impls = plugin.get_impl_set(config,'\.content$') |
191 impls = plugin.get_impl_set(config,'\.content$') |
195 impls.output = self.output |
192 context = plugin.GenerationContext(output=self.output) |
196 results = impls.generate() |
193 results = impls.generate(context) |
197 self.assertTrue(os.path.exists(impls.output)) |
194 self.assertTrue(os.path.exists(impls.output)) |
198 self.assertTrue(os.path.exists(os.path.join(impls.output,'content/prodX/jee/ProdX_specific.txt'))) |
195 self.assertTrue(os.path.exists(os.path.join(context.output,'content/prodX/jee/ProdX_specific.txt'))) |
199 |
196 |
200 def test_configuration_content_generate_with_include_refs(self): |
197 def test_configuration_content_generate_with_include_refs(self): |
201 impl = self.load_impl('assets/s60/implml/test_content_with_sequence_refs.content') |
198 impl = self.load_impl('assets/s60/implml/test_content_with_sequence_refs.content') |
202 impl.set_output_root(self.output) |
199 context = plugin.GenerationContext(output=self.output) |
203 results = impl.generate() |
200 results = impl.generate(context) |
204 self.assertTrue(os.path.exists(impl.output)) |
201 self.assertTrue(os.path.exists(os.path.join(context.output,'content/override.txt'))) |
205 self.assertTrue(os.path.exists(os.path.join(impl.output,'content/override.txt'))) |
202 |
|
203 def test_configuration_content_generate_with_external_input(self): |
|
204 impl = self.load_impl('assets/s60/implml/test_external_input.content') |
|
205 context = plugin.GenerationContext(output=self.output) |
|
206 results = impl.generate(context) |
|
207 self.assertTrue(os.path.exists(os.path.join(context.output,'content_external/abc.txt'))) |
|
208 self.assertTrue(os.path.exists(os.path.join(context.output,'content_external/folder1/data.txt'))) |
|
209 self.assertTrue(os.path.exists(os.path.join(context.output,'content_external2/folder2/setting.txt'))) |
206 |
210 |
207 def test_configuration_content_generate_with_multi_output(self): |
211 def test_configuration_content_generate_with_multi_output(self): |
208 impl = self.load_impl('assets/s60/implml/content2_with_multi_outputs.content') |
212 impl = self.load_impl('assets/s60/implml/content2_with_multi_outputs.content') |
209 impl.set_output_root(self.output) |
213 context = plugin.GenerationContext(output=self.output) |
210 results = impl.generate() |
214 results = impl.generate(context) |
211 self.assertTrue(os.path.exists(impl.output)) |
215 self.assertTrue(os.path.exists(os.path.join(context.output,'content/test/override.txt'))) |
212 self.assertTrue(os.path.exists(os.path.join(impl.output,'content/test/override.txt'))) |
216 self.assertTrue(os.path.exists(os.path.join(context.output,'include/s60.txt'))) |
213 self.assertTrue(os.path.exists(os.path.join(impl.output,'include/s60.txt'))) |
|
214 |
217 |
215 def test_configuration_content_generate_with_refs(self): |
218 def test_configuration_content_generate_with_refs(self): |
216 impl = self.load_impl('assets/s60/implml/test_content_with_refs2.content') |
219 impl = self.load_impl('assets/s60/implml/test_content_with_refs2.content') |
217 impl.set_output_root(self.output) |
220 context = plugin.GenerationContext(output=self.output) |
218 results = impl.generate() |
221 results = impl.generate(context) |
219 self.assertTrue(os.path.exists(impl.output)) |
222 self.assertTrue(os.path.exists(os.path.join(context.output,'content2p1/content2p2/override.txt'))) |
220 self.assertTrue(os.path.exists(os.path.join(impl.output,'content2p1/content2p2/override.txt'))) |
|
221 |
223 |
222 def test_configuration_content_generate_with_refs2(self): |
224 def test_configuration_content_generate_with_refs2(self): |
223 impl = self.load_impl('assets/s60/implml/test_content_with_refs3.content') |
225 impl = self.load_impl('assets/s60/implml/test_content_with_refs3.content') |
224 impl.set_output_root(self.output) |
226 context = plugin.GenerationContext(output=self.output) |
225 results = impl.generate() |
227 results = impl.generate(context) |
226 self.assertTrue(os.path.exists(impl.output)) |
228 self.assertTrue(os.path.exists(os.path.join(self.output,'example/content2p2/override.txt'))) |
227 self.assertTrue(os.path.exists(os.path.join(impl.output,'example/content2p2/override.txt'))) |
|
228 |
229 |
229 def test_configuration_content_generate_capital_letters(self): |
230 def test_configuration_content_generate_capital_letters(self): |
230 impl = self.load_impl('assets/s60/implml/test_content_capital_file_input.content') |
231 impl = self.load_impl('assets/s60/implml/test_content_capital_file_input.content') |
231 impl.set_output_root(self.output) |
232 context = plugin.GenerationContext(output=self.output) |
232 results = impl.generate() |
233 results = impl.generate(context) |
233 self.assertTrue(os.path.exists(impl.output)) |
234 self.assertTrue(os.path.exists(context.output)) |
234 self.assertTrue(os.path.exists(os.path.join(impl.output,'content/test_CAP_letters.txt'))) |
235 self.assertTrue(os.path.exists(os.path.join(context.output,'content/test_CAP_letters.txt'))) |
235 |
236 |
236 def test_get_refs(self): |
237 def test_get_refs(self): |
237 def check(filename, expected_refs): |
238 def check(filename, expected_refs): |
238 impl = self.load_impl('assets/s60/implml/' + filename) |
239 impl = self.load_impl('assets/s60/implml/' + filename) |
239 actual_refs = impl.get_refs() |
240 actual_refs = impl.get_refs() |