Browse Source

Merge "Fix noop job toDict()"

tags/3.6.0
Zuul 5 months ago
parent
commit
76ac47442f
2 changed files with 8 additions and 1 deletions
  1. 4
    0
      tests/unit/test_web.py
  2. 4
    1
      zuul/model.py

+ 4
- 0
tests/unit/test_web.py View File

@@ -572,6 +572,10 @@ class TestWeb(BaseTestWeb):
572 572
         resp = self.get_url("api/tenant/non-tenant/jobs")
573 573
         self.assertEqual(404, resp.status_code)
574 574
 
575
+    def test_web_job_noop(self):
576
+        job = self.get_url("api/tenant/tenant-one/job/noop").json()
577
+        self.assertEqual("noop", job[0]["name"])
578
+
575 579
 
576 580
 class TestInfo(BaseTestWeb):
577 581
 

+ 4
- 1
zuul/model.py View File

@@ -1141,7 +1141,10 @@ class Job(ConfigObject):
1141 1141
         d['irrelevant_files'] = self._irrelevant_files
1142 1142
         d['variant_description'] = self.variant_description
1143 1143
         d['implied_branch'] = self._implied_branch
1144
-        d['source_context'] = self.source_context.toDict()
1144
+        if self.source_context:
1145
+            d['source_context'] = self.source_context.toDict()
1146
+        else:
1147
+            d['source_context'] = None
1145 1148
         d['description'] = self.description
1146 1149
         d['required_projects'] = []
1147 1150
         for project in self.required_projects.values():

Loading…
Cancel
Save