예제 #1
0
    def test_request(self):
        """
        do some mocking of a requests request
        """

        configDict = {}
        configDict["Timeout"] = "30"
        configDict["access_certificate"] = os.path.join(
            self.fixture_path, "cert.pem")
        configDict["push_url"] = "https://notification.keyidentity.com/send"

        push_prov = DefaultPushProvider()
        push_prov.loadConfig(configDict)

        push_prov = DefaultPushProvider()
        push_prov.loadConfig(configDict)
        gda = ("apn.98c78e19e9842a1cfdeb887bf42142b615865b1ec513"
               "c31ea1a4f3222660435f")
        message = "Authentication request for user bla"

        # run the fake request
        status, response = push_prov.push_notification(
            challenge=message, gda=gda, transactionId="012345678901234")

        assert status
        assert response == VALID_REQUEST

        return
예제 #2
0
    def test_request(self):
        """
        do some mocking of a requests request
        """

        configDict = {}
        configDict['Timeout'] = '30'
        configDict['access_certificate'] = os.path.join(self.fixture_path,
                                                        'cert.pem')
        configDict['push_url'] = "https://notification.keyidentity.com/send"

        push_prov = DefaultPushProvider()
        push_prov.loadConfig(configDict)

        push_prov = DefaultPushProvider()
        push_prov.loadConfig(configDict)
        gda = ("apn.98c78e19e9842a1cfdeb887bf42142b615865b1ec513"
               "c31ea1a4f3222660435f")
        message = "Authentication request for user bla"

        # set the response status
        TestPushProviderController.R_AUTH_STATUS = 200

        # run the fake request
        status, response = push_prov.push_notification(
                                            challenge=message,
                                            gda=gda,
                                            transactionId='012345678901234')

        self.assertEquals(status, True)
        self.assertEquals(response, VALID_REQUEST)

        return
예제 #3
0
    def test_request(self):
        """
        do some mocking of a requests request
        """

        configDict = {}
        configDict['Timeout'] = '30'
        configDict['access_certificate'] = os.path.join(self.fixture_path,
                                                        'cert.pem')
        configDict['push_url'] = "https://notification.keyidentity.com/send"

        push_prov = DefaultPushProvider()
        push_prov.loadConfig(configDict)

        push_prov = DefaultPushProvider()
        push_prov.loadConfig(configDict)
        gda = ("apn.98c78e19e9842a1cfdeb887bf42142b615865b1ec513"
               "c31ea1a4f3222660435f")
        message = "Authentication request for user bla"

        # run the fake request
        status, response = push_prov.push_notification(
                                            challenge=message,
                                            gda=gda,
                                            transactionId='012345678901234')

        self.assertEquals(status, True)
        self.assertEquals(response, VALID_REQUEST)

        return
예제 #4
0
    def _test_servers(self, servers):
        configDict = {}
        configDict['Timeout'] = '30'
        configDict['access_certificate'] = os.path.join(
            self.fixture_path, 'cert.pem')
        configDict['push_url'] = servers

        push_prov = DefaultPushProvider()
        push_prov.loadConfig(configDict)

        push_prov = DefaultPushProvider()
        push_prov.loadConfig(configDict)
        gda = ("apn.98c78e19e9842a1cfdeb887bf42142b615865b1ec513"
               "c31ea1a4f3222660435f")
        message = "Authentication request for user bla"

        # run the fake request
        status, response = push_prov.push_notification(
            challenge=message, gda=gda, transactionId='012345678901234')

        self.assertEquals(status, True)
        self.assertEquals(response, VALID_REQUEST)