summaryrefslogtreecommitdiff
path: root/tests/test_tool.py
blob: 60c9594a39effc85d332dd6156191b72b7084560 (plain)
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
from wheel import tool


def test_convert_egg(egg_paths, tmpdir):
    tool.convert(egg_paths, str(tmpdir), verbose=False)
    assert len(tmpdir.listdir()) == len(egg_paths)


def test_unpack(wheel_paths, tmpdir):
    """
    Make sure 'wheel unpack' works.
    This also verifies the integrity of our testing wheel files.
    """
    for wheel_path in wheel_paths:
        tool.unpack(wheel_path, str(tmpdir))


def test_keygen():
    def get_keyring():
        WheelKeys, keyring = tool.get_keyring()

        class WheelKeysTest(WheelKeys):
            def save(self):
                pass

        class keyringTest:
            @classmethod
            def get_keyring(cls):
                class keyringTest2:
                    pw = None

                    def set_password(self, a, b, c):
                        self.pw = c

                    def get_password(self, a, b):
                        return self.pw

                return keyringTest2()

        return WheelKeysTest, keyringTest

    tool.keygen(get_keyring=get_keyring)