Exemplo n.º 1
0
    def test_verify_detached(cls, wrapper):
        """
        Tests detached sign validation
        """
        wrapper.return_value.execute.return_value = 'ErrorCode: 0x00000000'
        provider = ConsoleProvider(Config())

        provider.verify_detached(Path(), Path())
        wrapper.return_value.execute.assert_called_once()
Exemplo n.º 2
0
    def test_remove_crl(cls, wrapper):
        """
        Tests CRL removing
        """
        wrapper.return_value.execute.return_value = ''
        provider = ConsoleProvider(Config())

        provider.remove_crl('', '')
        wrapper.return_value.execute.assert_called_once()
Exemplo n.º 3
0
    def test_sign_detached(cls, wrapper):
        """
        Tests signing with detached sign
        """
        wrapper.return_value.execute.return_value = 'ErrorCode: 0x00000000'
        provider = ConsoleProvider(Config())

        provider.sign_detached(Path(), '', '')
        wrapper.return_value.execute.assert_called_once()
Exemplo n.º 4
0
    def test_add_crl(cls, wrapper):
        """
        Tests CRL adding
        """
        wrapper.return_value.execute.return_value = ''
        provider = ConsoleProvider(Config())

        provider.add_crl(Path(), '')
        wrapper.return_value.execute.assert_called_once()
Exemplo n.º 5
0
    def test_get_crl_absent(self, wrapper):
        """
        Tests absent CRL getting
        """
        wrapper.return_value.execute.return_value = ''
        provider = ConsoleProvider(Config())

        self.assertIsNone(provider.get_crl('', ''))
        wrapper.return_value.execute.assert_called_once()
Exemplo n.º 6
0
    def test_get_crl(self, wrapper):
        """
        Tests CRL getting
        """
        wrapper.return_value.execute.return_value = self.__crl_fixture
        provider = ConsoleProvider(Config())

        certificate = provider.get_crl('', '')

        self.__assert_crl(certificate,
                          '5aac2b534b8d50306757bab8289886b755444e03')
        wrapper.return_value.execute.assert_called_once()
Exemplo n.º 7
0
    def test_get_crl_list_empty(self, wrapper, list_filter):
        """
        Tests empty CRL list getting
        """
        wrapper.return_value.execute.return_value = ''
        list_filter.limit.return_value = 0
        list_filter.offset.return_value = 0
        provider = ConsoleProvider(Config())

        count, result = provider.get_crl_list('', list_filter)

        self.assertEqual(0, count)
        self.assertEqual(0, len(result))
        wrapper.return_value.execute.assert_called_once()
Exemplo n.º 8
0
    def test_get_certificate_list(self, wrapper, list_filter):
        """
        Tests certificate list getting
        """
        wrapper.return_value.execute.return_value = self.__cert_fixture
        list_filter.limit.return_value = 0
        list_filter.offset.return_value = 0
        provider = ConsoleProvider(Config())

        count, result = provider.get_certificate_list('', list_filter)

        self.assertEqual(5, count)
        self.assertEqual(5, len(result))
        certificate = result[0]
        self.__assert_cert(certificate,
                           '5aac2b534b8d50306757bab8289886b755444e03')
        wrapper.return_value.execute.assert_called_once()
Exemplo n.º 9
0
    def test_get_certificate_list_limited(self, wrapper, list_filter):
        """
        Tests certificate list getting
        """
        wrapper.return_value.execute.return_value = self.__cert_fixture
        list_filter.limit.return_value = 2
        list_filter.offset.return_value = 2
        provider = ConsoleProvider(Config())

        count, result = provider.get_certificate_list('', list_filter)

        self.assertEqual(5, count)
        self.assertEqual(2, len(result))
        certificate = result[0]
        self.__assert_cert(certificate,
                           '5ed7a78b451f46fae96b8959023f640f146ef1d7')
        wrapper.return_value.execute.assert_called_once()