diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml | 91 | ||||
-rw-r--r-- | bitbake/lib/toaster/toastergui/tests.py | 40 |
2 files changed, 94 insertions, 37 deletions
diff --git a/bitbake/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml b/bitbake/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml index cf35be4be6..213bf0f675 100644 --- a/bitbake/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml +++ b/bitbake/lib/toaster/toastergui/fixtures/toastergui-unittest-data.xml | |||
@@ -82,9 +82,8 @@ | |||
82 | <field to="orm.build" name="build" rel="ManyToOneRel">1</field> | 82 | <field to="orm.build" name="build" rel="ManyToOneRel">1</field> |
83 | <field type="CharField" name="target">a image recipe</field> | 83 | <field type="CharField" name="target">a image recipe</field> |
84 | <field type="CharField" name="task"><None></None></field> | 84 | <field type="CharField" name="task"><None></None></field> |
85 | <field type="BooleanField" name="is_image">False</field> | 85 | <field type="BooleanField" name="is_image">True</field> |
86 | <field type="IntegerField" name="image_size">0</field> | 86 | <field type="IntegerField" name="image_size">290</field> |
87 | <field type="CharField" name="license_manifest_path"><None></None></field> | ||
88 | </object> | 87 | </object> |
89 | <object pk="2" model="orm.target"> | 88 | <object pk="2" model="orm.target"> |
90 | <field to="orm.build" name="build" rel="ManyToOneRel">2</field> | 89 | <field to="orm.build" name="build" rel="ManyToOneRel">2</field> |
@@ -118,9 +117,9 @@ | |||
118 | </object> | 117 | </object> |
119 | <object pk="2" model="orm.package"> | 118 | <object pk="2" model="orm.package"> |
120 | <field to="orm.build" name="build" rel="ManyToOneRel">1</field> | 119 | <field to="orm.build" name="build" rel="ManyToOneRel">1</field> |
121 | <field to="orm.recipe" name="recipe" rel="ManyToOneRel">2</field> | 120 | <field to="orm.recipe" name="recipe" rel="ManyToOneRel">1</field> |
122 | <field type="CharField" name="name">f pkg</field> | 121 | <field type="CharField" name="name">f pkg</field> |
123 | <field type="CharField" name="installed_name"></field> | 122 | <field type="CharField" name="installed_name">f</field> |
124 | <field type="CharField" name="version"></field> | 123 | <field type="CharField" name="version"></field> |
125 | <field type="CharField" name="revision"></field> | 124 | <field type="CharField" name="revision"></field> |
126 | <field type="TextField" name="summary"></field> | 125 | <field type="TextField" name="summary"></field> |
@@ -297,6 +296,16 @@ | |||
297 | <field type="CharField" name="pathflags"></field> | 296 | <field type="CharField" name="pathflags"></field> |
298 | <field type="BooleanField" name="is_image">False</field> | 297 | <field type="BooleanField" name="is_image">False</field> |
299 | </object> | 298 | </object> |
299 | <!-- Added for an additional built recipe --> | ||
300 | <object pk="6" model="orm.recipe"> | ||
301 | <field type="CharField" name="name">g recipe</field> | ||
302 | <field type="CharField" name="version">1.2.3</field> | ||
303 | <field to="orm.layer_version" name="layer_version" rel="ManyToOneRel">3</field> | ||
304 | <field type="CharField" name="license">g license</field> | ||
305 | <field type="FilePathField" name="file_path">/g</field> | ||
306 | <field type="BooleanField" name="is_image">False</field> | ||
307 | </object> | ||
308 | |||
300 | <object pk="1" model="orm.machine"> | 309 | <object pk="1" model="orm.machine"> |
301 | <field to="orm.layersource" name="layer_source" rel="ManyToOneRel"><None></None></field> | 310 | <field to="orm.layersource" name="layer_source" rel="ManyToOneRel"><None></None></field> |
302 | <field type="IntegerField" name="up_id"><None></None></field> | 311 | <field type="IntegerField" name="up_id"><None></None></field> |
@@ -353,8 +362,6 @@ | |||
353 | </object> | 362 | </object> |
354 | <object pk="1" model="orm.branch"> | 363 | <object pk="1" model="orm.branch"> |
355 | <field to="orm.layersource" name="layer_source" rel="ManyToOneRel">1</field> | 364 | <field to="orm.layersource" name="layer_source" rel="ManyToOneRel">1</field> |
356 | <field type="IntegerField" name="up_id"><None></None></field> | ||
357 | <field type="DateTimeField" name="up_date"><None></None></field> | ||
358 | <field type="CharField" name="name">master</field> | 365 | <field type="CharField" name="name">master</field> |
359 | <field type="CharField" name="short_description"></field> | 366 | <field type="CharField" name="short_description"></field> |
360 | </object> | 367 | </object> |
@@ -363,13 +370,7 @@ | |||
363 | <field type="IntegerField" name="up_id"><None></None></field> | 370 | <field type="IntegerField" name="up_id"><None></None></field> |
364 | <field type="DateTimeField" name="up_date"><None></None></field> | 371 | <field type="DateTimeField" name="up_date"><None></None></field> |
365 | <field type="CharField" name="name">a layer</field> | 372 | <field type="CharField" name="name">a layer</field> |
366 | <field type="CharField" name="layer_index_url"></field> | ||
367 | <field type="CharField" name="vcs_url">/tmp/</field> | 373 | <field type="CharField" name="vcs_url">/tmp/</field> |
368 | <field type="CharField" name="vcs_web_url"><None></None></field> | ||
369 | <field type="CharField" name="vcs_web_tree_base_url"><None></None></field> | ||
370 | <field type="CharField" name="vcs_web_file_base_url"><None></None></field> | ||
371 | <field type="TextField" name="summary"><None></None></field> | ||
372 | <field type="TextField" name="description"><None></None></field> | ||
373 | </object> | 374 | </object> |
374 | <object pk="2" model="orm.layer"> | 375 | <object pk="2" model="orm.layer"> |
375 | <field to="orm.layersource" name="layer_source" rel="ManyToOneRel">1</field> | 376 | <field to="orm.layersource" name="layer_source" rel="ManyToOneRel">1</field> |
@@ -378,21 +379,16 @@ | |||
378 | <field type="CharField" name="name">z layer</field> | 379 | <field type="CharField" name="name">z layer</field> |
379 | <field type="CharField" name="layer_index_url"></field> | 380 | <field type="CharField" name="layer_index_url"></field> |
380 | <field type="CharField" name="vcs_url">git://two/</field> | 381 | <field type="CharField" name="vcs_url">git://two/</field> |
381 | <field type="CharField" name="vcs_web_url"><None></None></field> | ||
382 | <field type="CharField" name="vcs_web_tree_base_url"><None></None></field> | ||
383 | <field type="CharField" name="vcs_web_file_base_url"><None></None></field> | ||
384 | <field type="TextField" name="summary"><None></None></field> | ||
385 | <field type="TextField" name="description"><None></None></field> | ||
386 | </object> | 382 | </object> |
387 | <object pk="1" model="orm.layer_version"> | 383 | <object pk="1" model="orm.layer_version"> |
388 | <field to="orm.build" name="build" rel="ManyToOneRel"><None></None></field> | 384 | <field to="orm.build" name="build" rel="ManyToOneRel">1</field> |
389 | <field to="orm.layer" name="layer" rel="ManyToOneRel">1</field> | 385 | <field to="orm.layer" name="layer" rel="ManyToOneRel">1</field> |
390 | <field to="orm.layersource" name="layer_source" rel="ManyToOneRel">1</field> | 386 | <field to="orm.layersource" name="layer_source" rel="ManyToOneRel">1</field> |
391 | <field type="IntegerField" name="up_id"><None></None></field> | 387 | <field type="IntegerField" name="up_id"><None></None></field> |
392 | <field type="DateTimeField" name="up_date"><None></None></field> | 388 | <field type="DateTimeField" name="up_date"><None></None></field> |
393 | <field to="orm.branch" name="up_branch" rel="ManyToOneRel">1</field> | 389 | <field to="orm.branch" name="up_branch" rel="ManyToOneRel">1</field> |
394 | <field type="CharField" name="branch"></field> | 390 | <field type="CharField" name="branch">master</field> |
395 | <field type="CharField" name="commit">master</field> | 391 | <field type="CharField" name="commit">abcdef123</field> |
396 | <field type="CharField" name="dirpath">/tmp/</field> | 392 | <field type="CharField" name="dirpath">/tmp/</field> |
397 | <field type="IntegerField" name="priority">0</field> | 393 | <field type="IntegerField" name="priority">0</field> |
398 | <field type="FilePathField" name="local_path">/</field> | 394 | <field type="FilePathField" name="local_path">/</field> |
@@ -405,8 +401,22 @@ | |||
405 | <field type="IntegerField" name="up_id"><None></None></field> | 401 | <field type="IntegerField" name="up_id"><None></None></field> |
406 | <field type="DateTimeField" name="up_date"><None></None></field> | 402 | <field type="DateTimeField" name="up_date"><None></None></field> |
407 | <field to="orm.branch" name="up_branch" rel="ManyToOneRel">1</field> | 403 | <field to="orm.branch" name="up_branch" rel="ManyToOneRel">1</field> |
408 | <field type="CharField" name="branch"></field> | 404 | <field type="CharField" name="branch">testing-branch</field> |
409 | <field type="CharField" name="commit">master</field> | 405 | <field type="CharField" name="commit">9876fedcba</field> |
406 | <field type="CharField" name="dirpath"><None></None></field> | ||
407 | <field type="IntegerField" name="priority">0</field> | ||
408 | <field type="FilePathField" name="local_path">/</field> | ||
409 | <field to="orm.project" name="project" rel="ManyToOneRel"><None></None></field> | ||
410 | </object> | ||
411 | <object pk="3" model="orm.layer_version"> | ||
412 | <field to="orm.build" name="build" rel="ManyToOneRel">1</field> | ||
413 | <field to="orm.layer" name="layer" rel="ManyToOneRel">2</field> | ||
414 | <field to="orm.layersource" name="layer_source" rel="ManyToOneRel">1</field> | ||
415 | <field type="IntegerField" name="up_id"><None></None></field> | ||
416 | <field type="DateTimeField" name="up_date"><None></None></field> | ||
417 | <field to="orm.branch" name="up_branch" rel="ManyToOneRel">1</field> | ||
418 | <field type="CharField" name="branch">testing-branch</field> | ||
419 | <field type="CharField" name="commit">9876fedcba</field> | ||
410 | <field type="CharField" name="dirpath"><None></None></field> | 420 | <field type="CharField" name="dirpath"><None></None></field> |
411 | <field type="IntegerField" name="priority">0</field> | 421 | <field type="IntegerField" name="priority">0</field> |
412 | <field type="FilePathField" name="local_path">/</field> | 422 | <field type="FilePathField" name="local_path">/</field> |
@@ -443,4 +453,39 @@ | |||
443 | <field type="FilePathField" name="pathname"></field> | 453 | <field type="FilePathField" name="pathname"></field> |
444 | <field type="IntegerField" name="lineno"><None></None></field> | 454 | <field type="IntegerField" name="lineno"><None></None></field> |
445 | </object> | 455 | </object> |
456 | <!-- Some tasks for build 1 to test build tables --> | ||
457 | <object pk="1" model="orm.task"> | ||
458 | <field to="orm.build" name="build" rel="ManyToOneRel">1</field> | ||
459 | <field type="IntegerField" name="order">1</field> | ||
460 | <field type="BooleanField" name="task_executed">False</field> | ||
461 | <field type="IntegerField" name="outcome">-1</field> | ||
462 | <field type="CharField" name="sstate_checksum">abcdef123</field> | ||
463 | <field type="FilePathField" name="path_to_sstate_obj">34/wefw.tar</field> | ||
464 | <field to="orm.recipe" name="recipe" rel="ManyToOneRel">1</field> | ||
465 | <field type="CharField" name="task_name">a_do_compile</field> | ||
466 | <field type="DecimalField" name="elapsed_time">100</field> | ||
467 | <field type="IntegerField" name="disk_io">10</field> | ||
468 | <field type="IntegerField" name="disk_io_read">11</field> | ||
469 | <field type="IntegerField" name="disk_io_write">12</field> | ||
470 | <field type="DecimalField" name="cpu_time_user">10.1</field> | ||
471 | <field type="DecimalField" name="cpu_time_system">10.2</field> | ||
472 | <field type="IntegerField" name="sstate_result">3</field> | ||
473 | </object> | ||
474 | <object pk="2" model="orm.task"> | ||
475 | <field to="orm.build" name="build" rel="ManyToOneRel">1</field> | ||
476 | <field type="IntegerField" name="order">2</field> | ||
477 | <field type="BooleanField" name="task_executed">True</field> | ||
478 | <field type="IntegerField" name="outcome">2</field> | ||
479 | <field type="CharField" name="sstate_checksum">85bccb7802fd5f48</field> | ||
480 | <field type="FilePathField" name="path_to_sstate_obj">85/sstarpm.tgz</field> | ||
481 | <field to="orm.recipe" name="recipe" rel="ManyToOneRel">2</field> | ||
482 | <field type="CharField" name="task_name">z_do_package_write_rpm</field> | ||
483 | <field type="DecimalField" name="elapsed_time">245</field> | ||
484 | <field type="IntegerField" name="disk_io">12424</field> | ||
485 | <field type="IntegerField" name="disk_io_read">23423</field> | ||
486 | <field type="IntegerField" name="disk_io_write">83943</field> | ||
487 | <field type="DecimalField" name="cpu_time_user">20394.3</field> | ||
488 | <field type="DecimalField" name="cpu_time_system">5363.3</field> | ||
489 | <field type="IntegerField" name="sstate_result">1</field> | ||
490 | </object> | ||
446 | </django-objects> | 491 | </django-objects> |
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py index 869c39d84c..9af101804f 100644 --- a/bitbake/lib/toaster/toastergui/tests.py +++ b/bitbake/lib/toaster/toastergui/tests.py | |||
@@ -25,6 +25,7 @@ from django.test import TestCase | |||
25 | from django.test.client import RequestFactory | 25 | from django.test.client import RequestFactory |
26 | from django.core.urlresolvers import reverse | 26 | from django.core.urlresolvers import reverse |
27 | from django.utils import timezone | 27 | from django.utils import timezone |
28 | from django.db.models import Q | ||
28 | 29 | ||
29 | from orm.models import Project, Release, BitbakeVersion, Package, LogMessage | 30 | from orm.models import Project, Release, BitbakeVersion, Package, LogMessage |
30 | from orm.models import ReleaseLayerSourcePriority, LayerSource, Layer, Build | 31 | from orm.models import ReleaseLayerSourcePriority, LayerSource, Layer, Build |
@@ -57,7 +58,6 @@ class ViewTests(TestCase): | |||
57 | 58 | ||
58 | self.project = Project.objects.first() | 59 | self.project = Project.objects.first() |
59 | self.recipe1 = Recipe.objects.get(pk=2) | 60 | self.recipe1 = Recipe.objects.get(pk=2) |
60 | self.recipe2 = Recipe.objects.last() | ||
61 | self.customr = CustomImageRecipe.objects.first() | 61 | self.customr = CustomImageRecipe.objects.first() |
62 | self.cust_package = CustomImagePackage.objects.first() | 62 | self.cust_package = CustomImagePackage.objects.first() |
63 | self.package = Package.objects.first() | 63 | self.package = Package.objects.first() |
@@ -311,7 +311,6 @@ class ViewTests(TestCase): | |||
311 | 311 | ||
312 | self.assertEqual(response.status_code, 200) | 312 | self.assertEqual(response.status_code, 200) |
313 | 313 | ||
314 | |||
315 | def test_software_recipes_table(self): | 314 | def test_software_recipes_table(self): |
316 | """Test structure returned for Software RecipesTable""" | 315 | """Test structure returned for Software RecipesTable""" |
317 | table = SoftwareRecipesTable() | 316 | table = SoftwareRecipesTable() |
@@ -319,27 +318,35 @@ class ViewTests(TestCase): | |||
319 | response = table.get(request, pid=self.project.id) | 318 | response = table.get(request, pid=self.project.id) |
320 | data = json.loads(response.content) | 319 | data = json.loads(response.content) |
321 | 320 | ||
321 | recipes = Recipe.objects.filter(Q(is_image=False)) | ||
322 | self.assertTrue(len(recipes) > 1, | ||
323 | "Need more than one software recipe to test " | ||
324 | "SoftwareRecipesTable") | ||
325 | |||
326 | recipe1 = recipes[0] | ||
327 | recipe2 = recipes[1] | ||
328 | |||
322 | rows = data['rows'] | 329 | rows = data['rows'] |
323 | row1 = next(x for x in rows if x['name'] == self.recipe1.name) | 330 | row1 = next(x for x in rows if x['name'] == recipe1.name) |
324 | row2 = next(x for x in rows if x['name'] == self.recipe2.name) | 331 | row2 = next(x for x in rows if x['name'] == recipe2.name) |
325 | 332 | ||
326 | self.assertEqual(response.status_code, 200, 'should be 200 OK status') | 333 | self.assertEqual(response.status_code, 200, 'should be 200 OK status') |
327 | 334 | ||
328 | # check other columns have been populated correctly | 335 | # check other columns have been populated correctly |
329 | self.assertTrue(self.recipe1.name in row1['name']) | 336 | self.assertTrue(recipe1.name in row1['name']) |
330 | self.assertTrue(self.recipe1.version in row1['version']) | 337 | self.assertTrue(recipe1.version in row1['version']) |
331 | self.assertTrue(self.recipe1.description in | 338 | self.assertTrue(recipe1.description in |
332 | row1['get_description_or_summary']) | 339 | row1['get_description_or_summary']) |
333 | 340 | ||
334 | self.assertTrue(self.recipe1.layer_version.layer.name in | 341 | self.assertTrue(recipe1.layer_version.layer.name in |
335 | row1['layer_version__layer__name']) | 342 | row1['layer_version__layer__name']) |
336 | 343 | ||
337 | self.assertTrue(self.recipe2.name in row2['name']) | 344 | self.assertTrue(recipe2.name in row2['name']) |
338 | self.assertTrue(self.recipe2.version in row2['version']) | 345 | self.assertTrue(recipe2.version in row2['version']) |
339 | self.assertTrue(self.recipe2.description in | 346 | self.assertTrue(recipe2.description in |
340 | row2['get_description_or_summary']) | 347 | row2['get_description_or_summary']) |
341 | 348 | ||
342 | self.assertTrue(self.recipe2.layer_version.layer.name in | 349 | self.assertTrue(recipe2.layer_version.layer.name in |
343 | row2['layer_version__layer__name']) | 350 | row2['layer_version__layer__name']) |
344 | 351 | ||
345 | def test_toaster_tables(self): | 352 | def test_toaster_tables(self): |
@@ -360,7 +367,9 @@ class ViewTests(TestCase): | |||
360 | 'layerid': self.lver.pk, | 367 | 'layerid': self.lver.pk, |
361 | 'recipeid': self.recipe1.pk, | 368 | 'recipeid': self.recipe1.pk, |
362 | 'recipe_id': image_recipe.pk, | 369 | 'recipe_id': image_recipe.pk, |
363 | 'custrecipeid': self.customr.pk} | 370 | 'custrecipeid': self.customr.pk, |
371 | 'build_id': 1, | ||
372 | 'target_id': 1} | ||
364 | 373 | ||
365 | response = table.get(request, **args) | 374 | response = table.get(request, **args) |
366 | return json.loads(response.content) | 375 | return json.loads(response.content) |
@@ -386,11 +395,14 @@ class ViewTests(TestCase): | |||
386 | 395 | ||
387 | # Get a list of classes in tables module | 396 | # Get a list of classes in tables module |
388 | tables = inspect.getmembers(toastergui.tables, inspect.isclass) | 397 | tables = inspect.getmembers(toastergui.tables, inspect.isclass) |
398 | tables.extend(inspect.getmembers(toastergui.buildtables, | ||
399 | inspect.isclass)) | ||
389 | 400 | ||
390 | for name, table_cls in tables: | 401 | for name, table_cls in tables: |
391 | # Filter out the non ToasterTables from the tables module | 402 | # Filter out the non ToasterTables from the tables module |
392 | if not issubclass(table_cls, toastergui.widgets.ToasterTable) or \ | 403 | if not issubclass(table_cls, toastergui.widgets.ToasterTable) or \ |
393 | table_cls == toastergui.widgets.ToasterTable: | 404 | table_cls == toastergui.widgets.ToasterTable or \ |
405 | 'Mixin' in name: | ||
394 | continue | 406 | continue |
395 | 407 | ||
396 | # Get the table data without any options, this also does the | 408 | # Get the table data without any options, this also does the |