Exemplo n.º 1
0
    def setUp(self):
        self.test_server_proc = subprocess.Popen(SSL_SERVER_COMMAND, stdout=subprocess.PIPE)
        time.sleep(0.5)
        cert, key = generate_cert_and_pkey()
        self.service = APNService.objects.create(name='service', hostname='127.0.0.1',
                                                 private_key=key, certificate=cert)
        self.service.PORT = 2195  # For ease of use simply change port to default port in test_server

        self.notification = Notification.objects.create(service=self.service, message='Test message')
Exemplo n.º 2
0
 def setUp(self):
     self.started_at = datetime.datetime.now()
     self.test_server_proc = subprocess.Popen(SSL_SERVER_COMMAND, stdout=subprocess.PIPE)
     time.sleep(0.5)
     cert, key = generate_cert_and_pkey()
     self.service = APNService.objects.create(name='service', hostname='127.0.0.1',
                                              private_key=key, certificate=cert)
     self.service.PORT = 2195
     self.device = Device.objects.create(token=TOKEN, service=self.service)
Exemplo n.º 3
0
 def test_create_with_passphrase(self):
     cert, key = generate_cert_and_pkey(as_string=True, passphrase='pass')
     form = APNServiceForm({
         'name': 'test',
         'hostname': 'localhost',
         'certificate': cert,
         'private_key': key,
         'passphrase': 'pass'
     })
     self.assertTrue(form.is_valid())
Exemplo n.º 4
0
    def setUp(self):
        self.test_server_proc = subprocess.Popen(SSL_SERVER_COMMAND, stdout=subprocess.PIPE)
        time.sleep(0.5)  # Wait for test server to be started

        cert, key = generate_cert_and_pkey()
        self.service = APNService.objects.create(name='test-service', hostname='127.0.0.1',
                                                 certificate=cert, private_key=key)

        self.device = Device.objects.create(token=TOKEN, service=self.service)
        self.notification = Notification.objects.create(message='Test message', service=self.service)
Exemplo n.º 5
0
 def setUp(self):
     self.started_at = datetime.datetime.now()
     self.test_server_proc = subprocess.Popen(SSL_SERVER_COMMAND,
                                              stdout=subprocess.PIPE)
     time.sleep(0.5)
     cert, key = generate_cert_and_pkey()
     self.service = APNService.objects.create(name='service',
                                              hostname='127.0.0.1',
                                              private_key=key,
                                              certificate=cert)
     self.service.PORT = 2195
     self.device = Device.objects.create(token=TOKEN, service=self.service)
Exemplo n.º 6
0
    def setUp(self):
        self.test_server_proc = subprocess.Popen(SSL_SERVER_COMMAND,
                                                 stdout=subprocess.PIPE)
        time.sleep(0.5)
        cert, key = generate_cert_and_pkey()
        self.service = APNService.objects.create(name='service',
                                                 hostname='127.0.0.1',
                                                 private_key=key,
                                                 certificate=cert)
        self.service.PORT = 2195  # For ease of use simply change port to default port in test_server

        self.notification = Notification.objects.create(service=self.service,
                                                        message='Test message')
Exemplo n.º 7
0
    def setUp(self):
        self.test_server_proc = subprocess.Popen(SSL_SERVER_COMMAND,
                                                 stdout=subprocess.PIPE)
        time.sleep(0.5)  # Wait for test server to be started

        cert, key = generate_cert_and_pkey()
        self.service = APNService.objects.create(name='test-service',
                                                 hostname='127.0.0.1',
                                                 certificate=cert,
                                                 private_key=key)

        self.device = Device.objects.create(token=TOKEN, service=self.service)
        self.notification = Notification.objects.create(message='Test message',
                                                        service=self.service)
Exemplo n.º 8
0
 def test_create_with_invalid_passphrase(self):
     cert, key = generate_cert_and_pkey(as_string=True, passphrase='correct')
     form = APNServiceForm({'name': 'test', 'hostname': 'localhost', 'certificate': cert, 'private_key': key, 'passphrase': 'incorrect'})
     self.assertFalse(form.is_valid())
     self.assertTrue('passphrase' in form.errors)