You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
), f"The secret must not contain any non-alphanumeric characters. These characters are permitted: [a-zA-Z0-9]. The following characters are not alphanumeric '{non_alphanumeric}'."
Copy file name to clipboardExpand all lines: tests/test_config.py
+43-6Lines changed: 43 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
importcopy
2
2
importos
3
+
importre
3
4
importunittest
4
5
fromtypingimportAny
5
6
fromunittestimportmock
@@ -20,7 +21,6 @@
20
21
config: Any= {
21
22
"secret": "12345678",
22
23
"nameserver": "127.0.0.1",
23
-
"port": 53,
24
24
"zones": [
25
25
{
26
26
"name": "dyndns1.dev.",
@@ -40,23 +40,43 @@ class TestConfig:
40
40
deftest_config(self) ->None:
41
41
os.environ["dyndns_CONFIG_FILE"] =config_file
42
42
config=load_config()
43
-
assertconfig["secret"] ==12345678
43
+
assertconfig["secret"] =="12345678"
44
44
45
45
46
46
classTestFunctionValidateSecret:
47
47
deftest_valid(self) ->None:
48
48
assertvalidate_secret("abcd1234") =="abcd1234"
49
49
50
50
deftest_invalid_to_short(self) ->None:
51
-
withpytest.raises(ConfigurationError):
51
+
withpytest.raises(
52
+
AssertionError,
53
+
match="The secret must be at least 8 characters long. Currently the string is 7 characters long.",
54
+
):
52
55
validate_secret("1234567")
53
56
54
57
deftest_invalid_non_alpanumeric(self) ->None:
55
-
withpytest.raises(ConfigurationError):
58
+
withpytest.raises(
59
+
AssertionError,
60
+
match=re.escape(
61
+
"The secret must not contain any non-alphanumeric characters. These characters are permitted: [a-zA-Z0-9]. The following characters are not alphanumeric 'äüö'.",
0 commit comments