From 4b6e5c0ac1df609a1082b37b1e281deafe634dd1 Mon Sep 17 00:00:00 2001
From: Benjamin Bertrand <benjamin.bertrand@esss.se>
Date: Wed, 14 Mar 2018 11:42:27 +0100
Subject: [PATCH] Update cnames test

cnames entered in CSEntry are just names not FQDN
See d1f500238c5798259f536bb80fa93aba2d493b97
---
 tests/functional/factories.py | 2 +-
 tests/functional/test_api.py  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/functional/factories.py b/tests/functional/factories.py
index b347923..febdd62 100644
--- a/tests/functional/factories.py
+++ b/tests/functional/factories.py
@@ -182,6 +182,6 @@ class CnameFactory(factory.alchemy.SQLAlchemyModelFactory):
         sqlalchemy_session = common.Session
         sqlalchemy_session_persistence = 'commit'
 
-    name = factory.Sequence(lambda n: f'host{n}.example.org')
+    name = factory.Sequence(lambda n: f'host{n}')
     interface = factory.SubFactory(InterfaceFactory)
     user = factory.SubFactory(UserFactory)
diff --git a/tests/functional/test_api.py b/tests/functional/test_api.py
index 859f115..7faab03 100644
--- a/tests/functional/test_api.py
+++ b/tests/functional/test_api.py
@@ -871,7 +871,7 @@ def test_create_cname(client, interface, admin_token):
     # check that name and interface_id are mandatory
     response = post(client, f'{API_URL}/network/cnames', data={}, token=admin_token)
     check_response_message(response, "Missing mandatory field 'name'", 422)
-    response = post(client, f'{API_URL}/network/cnames', data={'name': 'myhost.example.org'}, token=admin_token)
+    response = post(client, f'{API_URL}/network/cnames', data={'name': 'myhost'}, token=admin_token)
     check_response_message(response, "Missing mandatory field 'interface_id'", 422)
     response = post(client, f'{API_URL}/network/cnames', data={'interface_id': interface.id}, token=admin_token)
     check_response_message(response, "Missing mandatory field 'name'", 422)
-- 
GitLab