summaryrefslogtreecommitdiff
path: root/service/test/unit/bitmask_libraries/test_certs.py
blob: 8caafe7ed7f7c960f44c42bbabffe8d49878a5ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import unittest

from pixelated.bitmask_libraries.certs import which_bundle
from pixelated.bitmask_libraries.config import AUTO_DETECT_CA_BUNDLE
from mock import MagicMock, patch


class CertsTest(unittest.TestCase):

    @patch('pixelated.bitmask_libraries.certs.os.path.isfile')
    def test_that_which_bundle_returns_byte_string(self, mock_isfile):
        mock_isfile.return_value = True
        config = MagicMock(ca_cert_bundle=AUTO_DETECT_CA_BUNDLE, certs_home='/some/path')
        provider = MagicMock(server_name=u'test.leap.net', config=config)

        bundle = which_bundle(provider)

        self.assertEqual('/some/path/test.leap.net.ca.crt', bundle)
        self.assertEqual(str, type(bundle))