From 226f186c30d36350ccfd306735ac5c82c485d8a2 Mon Sep 17 00:00:00 2001 From: Benjamin Bertrand <benjamin.bertrand@esss.se> Date: Wed, 28 Feb 2018 10:05:25 +0100 Subject: [PATCH] Add domain to interface json representation --- app/models.py | 1 + tests/functional/test_api.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models.py b/app/models.py index 0187857..6093e9a 100644 --- a/app/models.py +++ b/app/models.py @@ -617,6 +617,7 @@ class Interface(CreatedMixin, db.Model): 'mac': utils.format_field(self.mac), 'host': utils.format_field(self.host), 'cnames': [str(cname) for cname in self.cnames], + 'domain': str(self.network.domain), 'tags': [str(tag) for tag in self.tags], }) return d diff --git a/tests/functional/test_api.py b/tests/functional/test_api.py index 2909023..a74754f 100644 --- a/tests/functional/test_api.py +++ b/tests/functional/test_api.py @@ -613,7 +613,7 @@ def test_create_interface(client, network_factory, user_token): 'name': 'interface1'} response = post(client, f'{API_URL}/network/interfaces', data=data, token=user_token) assert response.status_code == 201 - assert {'id', 'network', 'ip', 'name', 'mac', + assert {'id', 'network', 'ip', 'name', 'mac', 'domain', 'host', 'cnames', 'tags', 'created_at', 'updated_at', 'user'} == set(response.json.keys()) assert response.json['network'] == network.vlan_name -- GitLab