diff mbox series

[1/2] Toaster: bug-fix on tests/views/test_views.python3

Message ID 20231017213755.479949-1-alassane.yattara@savoirfairelinux.com
State New
Headers show
Series [1/2] Toaster: bug-fix on tests/views/test_views.python3 | expand

Commit Message

Alassane Yattara Oct. 17, 2023, 9:37 p.m. UTC
- Create a tmp file for base recipe, otherwise test fail it doesn't exist
---
 lib/toaster/tests/views/test_views.py | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/lib/toaster/tests/views/test_views.py b/lib/toaster/tests/views/test_views.py
index f962e762..06bf6c20 100644
--- a/lib/toaster/tests/views/test_views.py
+++ b/lib/toaster/tests/views/test_views.py
@@ -41,7 +41,15 @@  class ViewTests(TestCase):
     def setUp(self):
 
         self.project = Project.objects.first()
+
         self.recipe1 = Recipe.objects.get(pk=2)
+        # create a file and to recipe1 file_path
+        file_path = f"/tmp/{self.recipe1.name.strip().replace(' ', '-')}.bb"
+        with open(file_path, 'w') as f:
+            f.write('foo')
+        self.recipe1.file_path = file_path
+        self.recipe1.save()
+
         self.customr = CustomImageRecipe.objects.first()
         self.cust_package = CustomImagePackage.objects.first()
         self.package = Package.objects.first()