def test_with_ca(self, tmpdir):
        ca = certs.CertStore.from_store(str(tmpdir), "test")
        r = certs.dummy_cert(
            ca.default_privatekey, ca.default_ca, b"foo.com",
            [b"one.com", b"two.com", b"*.three.com", b"127.0.0.1"])
        assert r.cn == b"foo.com"
        assert r.altnames == [b'one.com', b'two.com', b'*.three.com']

        r = certs.dummy_cert(ca.default_privatekey, ca.default_ca, None, [])
        assert r.cn is None
        assert r.altnames == []
Beispiel #2
0
    def test_with_ca(self, tstore):
        r = certs.dummy_cert(
            tstore.default_privatekey, tstore.default_ca._cert, "foo.com",
            ["one.com", "two.com", "*.three.com", "127.0.0.1"], "Foo Ltd.")
        assert r.cn == "foo.com"
        assert r.altnames == ["one.com", "two.com", "*.three.com", "127.0.0.1"]
        assert r.organization == "Foo Ltd."

        r = certs.dummy_cert(tstore.default_privatekey,
                             tstore.default_ca._cert, None, [], None)
        assert r.cn is None
        assert r.organization is None
        assert r.altnames == []
Beispiel #3
0
    def test_with_ca(self):
        with tutils.tmpdir() as d:
            ca = certs.CertStore.from_store(d, "test")
            r = certs.dummy_cert(
                ca.default_privatekey,
                ca.default_ca,
                b"foo.com",
                [b"one.com", b"two.com", b"*.three.com"]
            )
            assert r.cn == b"foo.com"

            r = certs.dummy_cert(
                ca.default_privatekey,
                ca.default_ca,
                None,
                []
            )
            assert r.cn is None
Beispiel #4
0
    def test_with_ca(self, tmpdir):
        ca = certs.CertStore.from_store(str(tmpdir), "test")
        r = certs.dummy_cert(
            ca.default_privatekey,
            ca.default_ca,
            b"foo.com",
            [b"one.com", b"two.com", b"*.three.com", b"127.0.0.1"]
        )
        assert r.cn == b"foo.com"
        assert r.altnames == [b'one.com', b'two.com', b'*.three.com']

        r = certs.dummy_cert(
            ca.default_privatekey,
            ca.default_ca,
            None,
            []
        )
        assert r.cn is None
        assert r.altnames == []