Ejemplo n.º 1
0
    def test_test_is_1(self):
        self.assertEqual(InvoicePrototype._db_count(), 0)
        with mock.patch('the_tale.finances.bank.logic.get_account_id', mock.Mock(return_value=1234)):
            result, invoice_id = pay(command=COMMAND_TYPE.PAY,
                                     external_md5=self.pay_md5,
                                     v1=self.user_email, v2=None, v3=None,
                                     id=self.xsolla_id, sum=self.payment_sum, test='1', date=None, request_url='bla-bla.test.com')

        self.assertTrue(result.is_SUCCESS)
        self.assertEqual(InvoicePrototype._db_count(), 1)
        self.assertTrue(InvoicePrototype._db_get_object(0).test)
Ejemplo n.º 2
0
    def test_user_not_exists(self):
        with mock.patch('the_tale.finances.bank.logic.get_account_id',
                        mock.Mock(return_value=None)) as bank_check_user:
            response = self.request_xml(self.construct_url())

        self.check_xml_ok(
            response,
            body=self.construct_pay_answer(
                PAY_RESULT.USER_NOT_EXISTS,
                internal_id=InvoicePrototype._db_get_object(0).id),
            encoding='cp1251')

        self.assertEqual(bank_check_user.call_count, 1)
        self.assertEqual(bank_check_user.call_args,
                         mock.call(email=self.user_email))
Ejemplo n.º 3
0
    def test_test_is_1(self):
        self.assertEqual(InvoicePrototype._db_count(), 0)
        with mock.patch('the_tale.finances.bank.logic.get_account_id',
                        mock.Mock(return_value=1234)):
            result, invoice_id = pay(command=COMMAND_TYPE.PAY,
                                     external_md5=self.pay_md5,
                                     v1=self.user_email,
                                     v2=None,
                                     v3=None,
                                     id=self.xsolla_id,
                                     sum=self.payment_sum,
                                     test='1',
                                     date=None,
                                     request_url=u'bla-bla.test.com')

        self.assertTrue(result.is_SUCCESS)
        self.assertEqual(InvoicePrototype._db_count(), 1)
        self.assertTrue(InvoicePrototype._db_get_object(0).test)
Ejemplo n.º 4
0
    def test_user_not_exists(self):
        with mock.patch('the_tale.finances.bank.logic.get_account_id', mock.Mock(return_value=None)) as bank_check_user:
            response = self.request_xml(self.construct_url())

        self.check_xml_ok(response,
                          body=self.construct_pay_answer(PAY_RESULT.USER_NOT_EXISTS, internal_id=InvoicePrototype._db_get_object(0).id),
                          encoding='cp1251')

        self.assertEqual(bank_check_user.call_count, 1)
        self.assertEqual(bank_check_user.call_args, mock.call(email=self.user_email))