Add unit test to test downloading end point and the basic content of the
custom recipe that is generated.

Signed-off-by: Michael Wood <[email protected]>
---
 bitbake/lib/toaster/toastergui/tests.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/toaster/toastergui/tests.py 
b/bitbake/lib/toaster/toastergui/tests.py
index f31be81..3683b51 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -79,6 +79,7 @@ class ViewTests(TestCase):
                                                  project=self.project,
                                                  layer_source=layersrc,
                                                  commit="master",
+                                                 dirpath="/tmp/",
                                                  up_branch=branch)
 
         lver_two = Layer_Version.objects.create(layer=layer_two,
@@ -95,6 +96,8 @@ class ViewTests(TestCase):
                               section="h section",
                               layer_version=lver_two)
 
+        # Create a dummy recipe file for the custom image generation to read
+        open("/tmp/my_recipe.bb", 'wa').close()
         self.recipe1 = Recipe.objects.create(layer_source=layersrc,
                                              name="base-recipe",
                                              version="1.2",
@@ -102,7 +105,8 @@ class ViewTests(TestCase):
                                              description="recipe",
                                              section="A section",
                                              license="Apache",
-                                             layer_version=self.lver)
+                                             layer_version=self.lver,
+                                             file_path="my_recipe.bb")
 
         Machine.objects.create(layer_version=self.lver, name="wisk",
                                description="wisking machine")
@@ -407,6 +411,14 @@ class ViewTests(TestCase):
                 self.assertNotEqual(json.loads(response.content),
                                     {"error": "ok"})
 
+    def test_download_custom_recipe(self):
+        response = self.client.get(reverse('customrecipedownload',
+                                           args=(self.project.id,
+                                                 self.customr.id)))
+
+        self.assertEqual(response.status_code, 200)
+
+
     def test_software_recipes_table(self):
         """Test structure returned for Software RecipesTable"""
         table = SoftwareRecipesTable()
-- 
2.1.4

-- 
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster

Reply via email to