def test_create_connect_to_apn(self): self.test_settings() apn_host = APN_HOST apn_port = APN_PORT passphrase = APN_PASSPHRASE key_path = _concat_path(key=True, development=False) cert_path = _concat_path(key=False, development=False) c = _create_apn_connection(apn_host, apn_port, key_path, cert_path, passphrase) data = binascii.unhexlify(SAMPLE_PACKET) c.send(data)
def test_settings(self): # This test is here to assert env is setup properly self.assertIsNotNone(APN_PORT, 'Cannot find value from `settings` file.') self.assertIsNotNone(APN_HOST, 'Cannot find value from `settings` file.') self.assertIsNotNone(APN_PASSPHRASE, 'Cannot find value from `settings` file.') self.assertIsNotNone(APN_CERTIFICATE_PATH_TEMPLATE, 'Cannot find value from `settings` file.') app_id = APN_DEFAULT_APP_ID self.assertIsNotNone(app_id) key_path = _concat_path(key=True, development=False) cert_path = _concat_path(key=False, development=False) self.assertTrue(os.path.exists(cert_path)) self.assertTrue(os.path.exists(key_path))