Commit d4707dda authored by Rémi Duraffort's avatar Rémi Duraffort

xmlrpc: improve testing

Also fix some crashes found while testing and remove some unneeded calls to
save().

Part of #18Signed-off-by: Rémi Duraffort's avatarRémi Duraffort <remi.duraffort@linaro.org>
parent 21a18dba
Pipeline #4698 passed with stages
in 10 minutes and 36 seconds
......@@ -60,7 +60,7 @@ class SchedulerAliasesAPI(ExposedV2API):
alias.full_clean()
alias.save()
except ValidationError as e:
raise xmlrpc.client.Fault(404, e.message)
raise xmlrpc.client.Fault(404, "\n".join(e.messages))
except DeviceType.DoesNotExist as nf:
raise xmlrpc.client.Fault(400, "Bad request. DeviceType does not exist")
except IntegrityError:
......
......@@ -405,7 +405,7 @@ class SchedulerDevicesAPI(ExposedV2API):
except Device.DoesNotExist:
raise xmlrpc.client.Fault(404, "Device '%s' was not found." % hostname)
except (IntegrityError, ValidationError) as exc:
raise xmlrpc.client.Fault(400, "Bad request: %s" % exc.message)
raise xmlrpc.client.Fault(400, "Bad request")
class SchedulerDevicesTagsAPI(ExposedV2API):
......@@ -440,7 +440,6 @@ class SchedulerDevicesTagsAPI(ExposedV2API):
tag, _ = Tag.objects.get_or_create(name=name)
device.tags.add(tag)
device.save()
def list(self, hostname):
"""
......@@ -501,4 +500,3 @@ class SchedulerDevicesTagsAPI(ExposedV2API):
raise xmlrpc.client.Fault(404, "Tag '%s' was not found." % name)
device.tags.remove(tag)
device.save()
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment