Ejemplo n.º 1
0
    def test_get_certificate_invalidation_position_url(self):
        """
        return url for cert invalidation position
        """
        pos = PositionGenerator().generate()
        pos.invalidate_certificate()

        serializer = PositionSerializer(instance=pos)
        self.assertIsNotNone(
            serializer.get_certificate_invalidation_position_url(pos))

        pos = PositionGenerator().generate()
        serializer = PositionSerializer(instance=pos)
        self.assertIsNone(
            serializer.get_certificate_invalidation_position_url(pos))
Ejemplo n.º 2
0
    def test_get_is_certificate_valid(self):
        """
        is certificate valid or was it returned
        """
        pos = PositionGenerator().generate()
        pos.invalidate_certificate()
        pos2 = pos.certificate_invalidation_position

        serializer = PositionSerializer(instance=pos)
        self.assertFalse(serializer.get_is_certificate_valid(pos))
        self.assertFalse(serializer.get_is_certificate_valid(pos2))

        pos = PositionGenerator().generate()
        serializer = PositionSerializer(instance=pos)
        self.assertIsNone(serializer.get_is_certificate_valid(pos))

        pos = PositionGenerator().generate(certificate_id='123')
        serializer = PositionSerializer(instance=pos)
        self.assertTrue(serializer.get_is_certificate_valid(pos))