Ejemplo n.º 1
0
 def update_signer(self, signer_id, status, status_datetime=None,
                   message=u''):
     signer = django_anysign.get_signer_model().objects.get(pk=signer_id)
     signer.status = status
     signer.status_datetime = status_datetime or now()
     signer.status_details = message
     signer.save()
Ejemplo n.º 2
0
    def test_get(self):
        """GET "anysign:signer" URL returns HTTP 200."""
        # Create a signature.
        SignatureType = django_anysign.get_signature_type_model()
        Signature = django_anysign.get_signature_model()
        Signer = django_anysign.get_signer_model()
        signature_type, created = SignatureType.objects.get_or_create(
            signature_backend_code='dummysign')
        signature = Signature.objects.create(signature_type=signature_type)
        signer = Signer.objects.create(signature=signature)
        signature.signers.add(signer)

        url = reverse('anysign:signer', args=[signer.pk])
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
Ejemplo n.º 3
0
    def test_get(self):
        """GET "anysign:signer" URL returns HTTP 200."""
        # Create a signature.
        SignatureType = django_anysign.get_signature_type_model()
        Signature = django_anysign.get_signature_model()
        Signer = django_anysign.get_signer_model()
        signature_type, created = SignatureType.objects.get_or_create(
            signature_backend_code='dummysign')
        signature = Signature.objects.create(signature_type=signature_type)
        signer = Signer.objects.create(signature=signature)
        signature.signers.add(signer)

        url = reverse('anysign:signer', args=[signer.pk])
        response = self.client.get(url)
        self.assertEqual(response.status_code, 200)
Ejemplo n.º 4
0
 def form_valid(self, form):
     # Create signature instance in local DB.
     SignatureType = django_anysign.get_signature_type_model()
     Signature = django_anysign.get_signature_model()
     Signer = django_anysign.get_signer_model()
     signature_type, created = SignatureType.objects.get_or_create(
         signature_backend_code='dummysign')
     signature = Signature.objects.create(signature_type=signature_type)
     Signer.objects.create(signature=signature)
     logger.debug(
         '[django_anysign_demo] Signature ID={id} created in local DB'
         .format(id=signature.id))
     # Register signature in backend's DB.
     signature.signature_backend.create_signature(signature)
     # Remember the signature object for later use (:meth:`get_success_url`)
     self.signature = signature
     # Handle the form as always.
     return FormView.form_valid(self, form)
Ejemplo n.º 5
0
    def test_post(self):
        """POST "anysign:signer" URL redirects to "signer return"."""
        # Create a signature.
        SignatureType = django_anysign.get_signature_type_model()
        Signature = django_anysign.get_signature_model()
        Signer = django_anysign.get_signer_model()
        signature_type, created = SignatureType.objects.get_or_create(
            signature_backend_code='dummysign')
        signature = Signature.objects.create(signature_type=signature_type)
        signer = Signer.objects.create(signature=signature)

        url = reverse('anysign:signer', args=[signer.pk])
        response = self.client.post(url, follow=True)
        signer_return_url = signature.signature_backend.get_signer_return_url(
            signer)
        self.assertEqual(signer_return_url,
                         reverse('anysign:signer_return', args=[signer.pk]))
        self.assertRedirects(response, signer_return_url)
        self.assertEqual(response.status_code, 200)
Ejemplo n.º 6
0
    def test_post(self):
        """POST "anysign:signer" URL redirects to "signer return"."""
        # Create a signature.
        SignatureType = django_anysign.get_signature_type_model()
        Signature = django_anysign.get_signature_model()
        Signer = django_anysign.get_signer_model()
        signature_type, created = SignatureType.objects.get_or_create(
            signature_backend_code='dummysign')
        signature = Signature.objects.create(signature_type=signature_type)
        signer = Signer.objects.create(signature=signature)

        url = reverse('anysign:signer', args=[signer.pk])
        response = self.client.post(url, follow=True)
        signer_return_url = signature.signature_backend.get_signer_return_url(
            signer)
        self.assertEqual(
            signer_return_url,
            reverse('anysign:signer_return', args=[signer.pk])
        )
        self.assertRedirects(response, signer_return_url)
        self.assertEqual(response.status_code, 200)
Ejemplo n.º 7
0
 def get_queryset(self):
     model = django_anysign.get_signer_model()
     return model.objects.all()
Ejemplo n.º 8
0
 def get_queryset(self):
     model = django_anysign.get_signer_model()
     return model.objects.all()
Ejemplo n.º 9
0
 def get_queryset(self):
     Signer = django_anysign.get_signer_model()
     return Signer.objects.all()
Ejemplo n.º 10
0
 class Meta:
     model = django_anysign.get_signer_model()
     fields = []