コード例 #1
0
    def test_init(self, parse, logger, ConfirmationPayload):
        data = {'TBK_PARAM': mock.Mock()}

        confirmation = Confirmation(self.commerce, self.request_ip, data)

        self.assertEqual(self.commerce, confirmation.commerce)
        self.assertEqual(self.request_ip, confirmation.request_ip)
        self.assertEqual(CONFIRMATION_TIMEOUT, confirmation.timeout)
        parse.assert_called_once_with(data['TBK_PARAM'])
        ConfirmationPayload.assert_called_once_with(parse.return_value)
        self.assertEqual(ConfirmationPayload.return_value,
                         confirmation.payload)
コード例 #2
0
ファイル: test_confirmation.py プロジェクト: Nodemio/tbk
    def test_init(self, parse, logger, ConfirmationPayload):
        data = {
            'TBK_PARAM': mock.Mock()
        }

        confirmation = Confirmation(self.commerce, self.request_ip, data)

        self.assertEqual(self.commerce, confirmation.commerce)
        self.assertEqual(self.request_ip, confirmation.request_ip)
        self.assertEqual(CONFIRMATION_TIMEOUT, confirmation.timeout)
        parse.assert_called_once_with(data['TBK_PARAM'])
        ConfirmationPayload.assert_called_once_with(parse.return_value)
        self.assertEqual(
            ConfirmationPayload.return_value, confirmation.payload)
コード例 #3
0
    def test_parse(self, logger, ConfirmationPayload):
        with open(
                os.path.join(os.path.dirname(__file__), 'fixtures',
                             'confirmation.txt')) as f:
            confirmation_data = f.read()
        data = {'TBK_PARAM': mock.Mock()}
        self.commerce.webpay_decrypt.return_value = (confirmation_data,
                                                     "signature")

        confirmation = Confirmation(self.commerce, self.request_ip, data)

        params = CONFIRMATION_DATA.copy()
        params['TBK_MAC'] = "signature"

        self.commerce.webpay_decrypt.assert_called_once_with(data['TBK_PARAM'])
        ConfirmationPayload.assert_called_once_with(params)
        self.assertEqual(ConfirmationPayload.return_value,
                         confirmation.payload)
コード例 #4
0
ファイル: test_confirmation.py プロジェクト: Nodemio/tbk
    def test_parse(self, logger, ConfirmationPayload):
        with open(os.path.join(os.path.dirname(__file__), 'fixtures', 'confirmation.txt')) as f:
            confirmation_data = f.read()
        data = {
            'TBK_PARAM': mock.Mock()
        }
        self.commerce.webpay_decrypt.return_value = (
            confirmation_data, "signature")

        confirmation = Confirmation(self.commerce, self.request_ip, data)

        params = CONFIRMATION_DATA.copy()
        params['TBK_MAC'] = "signature"

        self.commerce.webpay_decrypt.assert_called_once_with(data['TBK_PARAM'])
        ConfirmationPayload.assert_called_once_with(params)
        self.assertEqual(
            ConfirmationPayload.return_value, confirmation.payload)