def test_get_page_image(self, mock_get_page_image): backend = django_docusign.DocuSignBackend() signature = mock.Mock() signature.signature_backend_id = 999 backend.get_page_image(signature, 1, 1, 72, 300) mock_get_page_image.assert_called_once_with(999, 1, 1, 72, 300, None)
def test_setup_explicit(self): """DocuSignBackend() proxies options to DocuSignClient().""" explicit_options = { 'root_url': 'http://example.com', 'username': '******', 'password': '******', 'integrator_key': 'very-secret', 'account_id': 'some-uuid', 'app_token': 'some-token', 'timeout': 300.0, } backend = django_docusign.DocuSignBackend(**explicit_options) for key, value in explicit_options.items(): self.assertEqual(getattr(backend.docusign_client, key), value)
def test_setup_settings(self): """DocuSignBackend uses settings.DOCUSIGN_*.""" overrides = { 'DOCUSIGN_ROOT_URL': 'http://example.com', 'DOCUSIGN_USERNAME': '******', 'DOCUSIGN_PASSWORD': '******', 'DOCUSIGN_INTEGRATOR_KEY': 'not-an-integator-key', 'DOCUSIGN_ACCOUNT_ID': 'not-an-uuid', 'DOCUSIGN_APP_TOKEN': 'not-a-token', 'DOCUSIGN_TIMEOUT': 200.123, } with override_settings(**overrides): backend = django_docusign.DocuSignBackend() for key, value in overrides.items(): key = key.lower()[len('DOCUSIGN_'):] self.assertEqual(getattr(backend.docusign_client, key), value)
def test_setup_priority(self): """Explicit arguments have priority over settings.""" explicit_options = { 'root_url': 'http://example.com', 'username': '******', 'password': '******', 'integrator_key': 'very-secret', 'account_id': 'some-uuid', 'app_token': 'some-token', 'timeout': 300.0, } overrides = { 'DOCUSIGN_ROOT_URL': 'http://another.example.com', 'DOCUSIGN_USERNAME': '******', 'DOCUSIGN_PASSWORD': '******', 'DOCUSIGN_INTEGRATOR_KEY': 'not-an-integator-key', 'DOCUSIGN_ACCOUNT_ID': 'not-an-uuid', 'DOCUSIGN_APP_TOKEN': 'not-a-token', 'DOCUSIGN_TIMEOUT': 200.123, } with override_settings(**overrides): backend = django_docusign.DocuSignBackend(**explicit_options) for key, value in explicit_options.items(): self.assertEqual(getattr(backend.docusign_client, key), value)
def get_context_data(self, **kwargs): data = super(SettingsView, self).get_context_data(**kwargs) data['default_backend'] = django_docusign.DocuSignBackend() return data