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()
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()
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()
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()
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()
def _get_service(cls, provider: CryptoProviderInterface) -> CryptoProService: """ Gets CryptoPro service """ factory = mock.Mock(CryptoProviderFactory) factory.get_provider.return_value = provider service = CryptoProService(factory, Config(CONFIG)) return service
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()
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()
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()
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()
def setUp(self): self.__factory = CryptoProviderFactory(Config())