Parcourir la source

feat(e2e2): adds tests for serial increase

Nils Wisiol il y a 3 ans
Parent
commit
1855b49560
1 fichiers modifiés avec 26 ajouts et 1 suppressions
  1. 26 1
      test/e2e2/spec/test_api_domains.py

+ 26 - 1
test/e2e2/spec/test_api_domains.py

@@ -1,10 +1,14 @@
-from conftest import DeSECAPIV1Client, NSLordClient, random_domainname
+import time
+
+import pytest
+from conftest import DeSECAPIV1Client, NSLordClient, random_domainname, FaketimeShift
 
 
 def test_create(api_user: DeSECAPIV1Client):
     assert len(api_user.domain_list()) == 0
     assert api_user.domain_create(random_domainname()).status_code == 201
     assert len(api_user.domain_list()) == 1
+    assert NSLordClient.query(api_user.domain, 'SOA')[0].serial >= int(time.time())
 
 
 def test_get(api_user_domain: DeSECAPIV1Client):
@@ -13,7 +17,28 @@ def test_get(api_user_domain: DeSECAPIV1Client):
     assert domain['name'] == api_user_domain.domain
 
 
+def test_modify(api_user_domain: DeSECAPIV1Client):
+    old_serial = NSLordClient.query(api_user_domain.domain, 'SOA')[0].serial
+    api_user_domain.rr_set_create(api_user_domain.domain, 'A', ['127.0.0.1'])
+    assert NSLordClient.query(api_user_domain.domain, 'SOA')[0].serial > old_serial
+
+
+def test_rrsig_rollover(api_user_domain: DeSECAPIV1Client):
+    old_serial = NSLordClient.query(api_user_domain.domain, 'SOA')[0].serial
+    with FaketimeShift(days=7):
+        assert NSLordClient.query(api_user_domain.domain, 'SOA')[0].serial > old_serial
+
+
 def test_destroy(api_user_domain: DeSECAPIV1Client):
     n = len(api_user_domain.domain_list())
     assert api_user_domain.domain_destroy(api_user_domain.domain).status_code == 204
     assert len(api_user_domain.domain_list()) == n - 1
+
+
+@pytest.mark.skip  # TODO currently broken
+def test_recreate(api_user_domain: DeSECAPIV1Client):
+    name = api_user_domain.domain
+    old_serial = NSLordClient.query(name, 'SOA')[0].serial
+    assert api_user_domain.domain_destroy(name).status_code == 204
+    assert api_user_domain.domain_create(name).status_code == 201
+    assert NSLordClient.query(name, 'SOA')[0].serial > old_serial