summaryrefslogtreecommitdiff
path: root/smoketest/scripts
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-05-12 18:01:19 +0200
committerGitHub <noreply@github.com>2023-05-12 18:01:19 +0200
commit0224707acc7299b02eccdd1d2df434c4a57402b5 (patch)
tree98d05417f52baacd9c88442f41dbcd5fd20af004 /smoketest/scripts
parent25545b1e3cf2e94f3521e4ed80ce744f4b08683e (diff)
parent9fc53924271c151e3e5229a64acec35006d4f7fe (diff)
downloadvyos-1x-0224707acc7299b02eccdd1d2df434c4a57402b5.tar.gz
vyos-1x-0224707acc7299b02eccdd1d2df434c4a57402b5.zip
Merge pull request #2002 from Zen3515/fix-cloudflare-ddns
T5219: ddclient: Allow not set login for Cloudflare API token
Diffstat (limited to 'smoketest/scripts')
-rwxr-xr-xsmoketest/scripts/cli/test_service_dns_dynamic.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/smoketest/scripts/cli/test_service_dns_dynamic.py b/smoketest/scripts/cli/test_service_dns_dynamic.py
index 57705e26f..a3aa41f94 100755
--- a/smoketest/scripts/cli/test_service_dns_dynamic.py
+++ b/smoketest/scripts/cli/test_service_dns_dynamic.py
@@ -45,22 +45,32 @@ class TestServiceDDNS(VyOSUnitTestSHIM.TestCase):
self.cli_commit()
def test_dyndns_service(self):
+ from itertools import product
ddns = ['interface', interface, 'service']
+ users = [None, 'vyos_user']
services = ['cloudflare', 'afraid', 'dyndns', 'zoneedit']
- for service in services:
- user = 'vyos_user'
+ for user, service in product(users, services):
password = 'vyos_pass'
zone = 'vyos.io'
self.cli_delete(base_path)
self.cli_set(base_path + ddns + [service, 'host-name', hostname])
- self.cli_set(base_path + ddns + [service, 'login', user])
+ if user is not None:
+ self.cli_set(base_path + ddns + [service, 'login', user])
self.cli_set(base_path + ddns + [service, 'password', password])
self.cli_set(base_path + ddns + [service, 'zone', zone])
# commit changes
if service == 'cloudflare':
self.cli_commit()
+ elif user is None:
+ # not set user is only allowed for cloudflare
+ with self.assertRaises(ConfigSessionError):
+ # remove zone to test not set user
+ self.cli_delete(base_path + ddns + [service, 'zone', 'vyos.io'])
+ self.cli_commit()
+ # this case is fininshed, user not set is not allowed when service isn't cloudflare
+ continue
else:
# zone option only works on cloudflare, an exception is raised
# for all others
@@ -72,7 +82,7 @@ class TestServiceDDNS(VyOSUnitTestSHIM.TestCase):
# we can only read the configuration file when we operate as 'root'
protocol = get_config_value('protocol')
- login = get_config_value('login')
+ login = None if user is None else get_config_value('login')
pwd = get_config_value('password')
# some services need special treatment