Exemplo n.º 1
0
 def test_bad_fcm_senders(self):
     old_auth = self.TestArg.fcm_auth
     old_senderid = self.TestArg.fcm_senderid
     self.TestArg.fcm_auth = ""
     ap = make_settings(self.TestArg)
     eq_(ap, None)
     self.TestArg.fcm_auth = old_auth
     self.TestArg.fcm_senderid = ""
     ap = make_settings(self.TestArg)
     eq_(ap, None)
     self.TestArg.fcm_senderid = old_senderid
Exemplo n.º 2
0
    def test_ping_settings(self):
        class arg:
            # important stuff
            external_router = True
            gcm_apikey = "gcm.key"
            apns_cert_file = "cert.file"
            apns_key_file = "key.file"
            # less important stuff
            apns_sandbox = False
            gcm_ttl = 999
            gcm_dryrun = False
            gcm_collapsekey = "collapse"

            # filler
            crypto_key = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA='
            datadog_api_key = "datadog_api_key"
            datadog_app_key = "datadog_app_key"
            datadog_flush_interval = "datadog_flush_interval"
            hostname = "hostname"
            statsd_host = "statsd_host"
            statsd_port = "statsd_port"
            router_tablename = "None"
            storage_tablename = "None"
            storage_read_throughput = 0
            storage_write_throughput = 0
            router_read_throughput = 0
            router_write_throughput = 0
            resolve_hostname = False

        ap = make_settings(arg)
        eq_(ap.routers["gcm"].gcm.api_key, arg.gcm_apikey)
        eq_(ap.routers["apns"].apns.cert_file, arg.apns_cert_file)
        eq_(ap.routers["apns"].apns.key_file, arg.apns_key_file)
Exemplo n.º 3
0
    def test_aws_ami_id(self, request_mock, mt, mc):
        class MockReply:
            content = "ami_123"

        request_mock.return_value = MockReply
        self.TestArg.no_aws = False
        ap = make_settings(self.TestArg)
        eq_(ap.ami_id, "ami_123")
Exemplo n.º 4
0
 def test_settings(self, *args):
     ap = make_settings(self.TestArg)
     # verify that the hostname is what we said.
     eq_(ap.hostname, self.TestArg.hostname)
     eq_(ap.routers["gcm"].config['collapsekey'], "collapse")
     eq_(ap.routers["apns"]._config['firefox']['cert'], "cert.file")
     eq_(ap.routers["apns"]._config['firefox']['key'], "key.file")
     eq_(ap.wake_timeout, 10)
Exemplo n.º 5
0
 def test_ping_settings(self):
     ap = make_settings(self.test_arg)
     # verify that the hostname is what we said.
     eq_(ap.hostname, self.test_arg.hostname)
     # gcm isn't created until later since we may have to pull
     # config info from s3
     eq_(ap.routers["apns"].apns.cert_file, self.test_arg.apns_cert_file)
     eq_(ap.routers["apns"].apns.key_file, self.test_arg.apns_key_file)
     eq_(ap.wake_timeout, 10)
Exemplo n.º 6
0
 def test_ping_settings(self):
     ap = make_settings(self.test_arg)
     # verify that the hostname is what we said.
     eq_(ap.hostname, self.test_arg.hostname)
     # gcm isn't created until later since we may have to pull
     # config info from s3
     eq_(ap.routers["apns"].apns.cert_file, self.test_arg.apns_cert_file)
     eq_(ap.routers["apns"].apns.key_file, self.test_arg.apns_key_file)
     eq_(ap.wake_timeout, 10)
Exemplo n.º 7
0
 def test_bad_senders(self):
     oldList = self.test_arg.senderid_list
     self.test_arg.senderid_list = "{}"
     ap = make_settings(self.test_arg)
     eq_(ap, None)
     self.test_arg.senderid_list = oldList
Exemplo n.º 8
0
 def test_bad_senders(self):
     oldList = self.test_arg.senderid_list
     self.test_arg.senderid_list = "{}"
     ap = make_settings(self.test_arg)
     eq_(ap, None)
     self.test_arg.senderid_list = oldList
Exemplo n.º 9
0
 def test_client_certs_parse(self, mock):
     ap = make_settings(self.TestArg)
     eq_(ap.client_certs["1A:" * 31 + "F9"], 'partner1')
     eq_(ap.client_certs["2B:" * 31 + "E8"], 'partner2')
     eq_(ap.client_certs["3C:" * 31 + "D7"], 'partner2')