]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toaster: toastergui Fix invalid char test and implementation
authorMichael Wood <michael.g.wood@intel.com>
Fri, 19 Feb 2016 05:21:52 +0000 (21:21 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 19 Feb 2016 15:38:20 +0000 (15:38 +0000)
This test was passing but because the assertion was the wrong way round
and should have expected the first one to pass and second one to fail,
in reality both were failing as the method for checking the invalid char
was incorrect.

Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: brian avery <avery.brian@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/toaster/toastergui/tests.py
lib/toaster/toastergui/views.py

index 1b6e78d517c08ec31f500c5c30f623ac10403649..4e420ea26995abe087578145de0a6c8e365a3767 100644 (file)
@@ -155,7 +155,7 @@ class ViewTests(TestCase):
         response = self.client.post(reverse('xhr_importlayer'), args)
         data = json.loads(response.content)
         self.assertEqual(response.status_code, 200)
-        self.assertNotEqual(data["error"], "ok")
+        self.assertEqual(data["error"], "ok")
 
         #Test to verify import of a layer successful
         args['name'] = "meta-oe"
index dfa256e8eafb829ed5fb5af0184f9c34b9168050..13489af6fda39df3a5b277801d766aee7b2e4d14 100755 (executable)
@@ -2185,8 +2185,11 @@ if True:
         layers_added = [];
 
         # Rudimentary check for any possible html tags
-        if "<" in request.POST:
-          return HttpResponse(jsonfilter({"error": "Invalid character <"}), content_type = "application/json")
+        for val in request.POST.values():
+            if "<" in val:
+                return HttpResponse(jsonfilter(
+                    {"error": "Invalid character <"}),
+                    content_type="application/json")
 
         prj = Project.objects.get(pk=request.POST['project_id'])