File: test_010_store_migrate.py

package info (click to toggle)
apache2 2.4.66-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 59,960 kB
  • sloc: ansic: 212,327; python: 13,830; perl: 11,307; sh: 7,266; php: 1,320; javascript: 1,314; awk: 749; makefile: 715; lex: 374; yacc: 161; xml: 2
file content (43 lines) | stat: -rw-r--r-- 1,667 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# test mod_md acme terms-of-service handling

import os
import pytest

from .md_conf import MDConf
from .md_env import MDTestEnv


@pytest.mark.skipif(condition=not MDTestEnv.has_a2md(), reason="no a2md available")
class TestStoreMigrate:

    @pytest.fixture(autouse=True, scope='class')
    def _class_scope(self, env):
        MDConf(env).install()
        assert env.apache_restart() == 0, f'{env.apachectl_stderr}'

    # install old store, start a2md list, check files afterwards
    def test_md_010_000(self, env):
        domain = "7007-1502285564.org"
        env.replace_store(os.path.join(env.test_dir, "../modules/md/data/store_migrate/1.0/sample1"))
        #
        # use 1.0 file name for private key
        fpkey_1_0 = os.path.join(env.store_dir, 'domains', domain, 'pkey.pem')
        fpkey_1_1 = os.path.join(env.store_dir, 'domains', domain, 'privkey.pem')
        cert_1_0 = os.path.join(env.store_dir, 'domains', domain, 'cert.pem')
        cert_1_1 = os.path.join(env.store_dir, 'domains', domain, 'pubcert.pem')
        chain_1_0 = os.path.join(env.store_dir, 'domains', domain, 'chain.pem')
        #
        assert os.path.exists(fpkey_1_0)
        assert os.path.exists(cert_1_0)
        assert os.path.exists(chain_1_0)
        assert not os.path.exists(fpkey_1_1)
        assert not os.path.exists(cert_1_1)
        #
        md = env.a2md(["-vvv", "list", domain]).json['output'][0]
        assert domain == md["name"]
        #
        assert not os.path.exists(fpkey_1_0)
        assert os.path.exists(cert_1_0)
        assert os.path.exists(chain_1_0)
        assert os.path.exists(fpkey_1_1)
        assert os.path.exists(cert_1_1)