Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- + py.test tests --junitxml=./junit.xml
- ============================= test session starts ==============================
- platform linux2 -- Python 2.7.3 -- py-1.4.22 -- pytest-2.5.2
- collected 142 items
- tests/test_brand.py .........
- tests/test_crud.py .....................
- tests/test_event.py .....
- tests/test_mailer.py .......
- tests/test_payments_balance.py ....................................FF..
- tests/test_payments_event.py .....FFFFF...
- tests/test_payments_plan.py ..............FFFFFFF....
- tests/test_payments_transaction.py ........
- tests/test_recordings.py ....
- tests/test_topics.py .....
- tests/test_user.py .....
- =================================== FAILURES ===================================
- ____________ TestUserBalanceTopup.test_user_balance_check_and_aviso ____________
- args = (<tests.test_payments_balance.TestUserBalanceTopup testMethod=test_user_balance_check_and_aviso>, <MagicMock name='NotifyMessage' id='60182800'>)
- keywargs = {}, extra_args = [<MagicMock name='NotifyMessage' id='60182800'>]
- entered_patchers = [<mock._patch object at 0x2f98b50>]
- exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x3039290>)
- patching = <mock._patch object at 0x2f98b50>
- arg = <MagicMock name='NotifyMessage' id='60182800'>
- @wraps(func)
- def patched(*args, **keywargs):
- # don't use a with here (backwards compatability with Python 2.4)
- extra_args = []
- entered_patchers = []
- # can't use try...except...finally because of Python 2.4
- # compatibility
- exc_info = tuple()
- try:
- try:
- for patching in patched.patchings:
- arg = patching.__enter__()
- entered_patchers.append(patching)
- if patching.attribute_name is not None:
- keywargs.update(arg)
- elif patching.new is DEFAULT:
- extra_args.append(arg)
- args += tuple(extra_args)
- > return func(*args, **keywargs)
- .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <tests.test_payments_balance.TestUserBalanceTopup testMethod=test_user_balance_check_and_aviso>
- MockedNotifyMessage = <MagicMock name='NotifyMessage' id='60182800'>
- @patch('praktikum.libs.notify.notify.NotifyMessage')
- def test_user_balance_check_and_aviso(self, MockedNotifyMessage):
- user = User(id='53a191da9622a456a71d6e18', email='test@email.com',
- password='qwerty').save()
- self.add_to_balance(user, 50)
- invoice_id = 1234567
- sum_amount = '148'
- shop_sum_amount = '143' # payment system commissions
- db_alias = DEFAULT_CONNECTION_NAME
- # check
- md5 = '0FA2C2E09694F008D67C04FE5C70C50B'
- data = self.get_yandex_check_data(user, invoice_id, user.id,
- sum_amount, shop_sum_amount, db_alias, md5)
- post_data = urlencode(data)
- response = self.fetch(self.get_url('/api/payments/yandex/chek'),
- method="POST", body=post_data)
- self.assertYandexNotificationResponseValid(response, invoice_id, db_alias,
- T.PAY_STATUS.started, "checkOrder", "checkOrderResponse",
- > sum_amount, user)
- tests/test_payments_balance.py:842:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <tests.test_payments_balance.TestUserBalanceTopup testMethod=test_user_balance_check_and_aviso>
- response = HTTPResponse(_body=None,buffer=<_io.BytesIO object at 0x2b8ffb0>,code=405,effe...TPRequest object at 0x301f250>,request_time=0.0040798187255859375,time_info={})
- invoice_id = 1234567, db_alias = 'default', pay_status = 'started'
- action = 'checkOrder', xml_action = 'checkOrderResponse', sum_amount = '148'
- payed_item = <User: test@email.com>
- def assertYandexNotificationResponseValid(self, response, invoice_id, db_alias, pay_status,
- action, xml_action, sum_amount, payed_item):
- > self.assertEqual(200, response.code)
- E AssertionError: 200 != 405
- tests/test_payments_event.py:141: AssertionError
- ------------------------------- Captured stderr --------------------------------
- WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.23ms
- ______________ TestUserBalanceTopup.test_user_balance_check_fail _______________
- args = (<tests.test_payments_balance.TestUserBalanceTopup testMethod=test_user_balance_check_fail>, <MagicMock name='NotifyMessage' id='57274448'>)
- keywargs = {}, extra_args = [<MagicMock name='NotifyMessage' id='57274448'>]
- entered_patchers = [<mock._patch object at 0x2f98c90>]
- exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x2b91758>)
- patching = <mock._patch object at 0x2f98c90>
- arg = <MagicMock name='NotifyMessage' id='57274448'>
- @wraps(func)
- def patched(*args, **keywargs):
- # don't use a with here (backwards compatability with Python 2.4)
- extra_args = []
- entered_patchers = []
- # can't use try...except...finally because of Python 2.4
- # compatibility
- exc_info = tuple()
- try:
- try:
- for patching in patched.patchings:
- arg = patching.__enter__()
- entered_patchers.append(patching)
- if patching.attribute_name is not None:
- keywargs.update(arg)
- elif patching.new is DEFAULT:
- extra_args.append(arg)
- args += tuple(extra_args)
- > return func(*args, **keywargs)
- .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <tests.test_payments_balance.TestUserBalanceTopup testMethod=test_user_balance_check_fail>
- MockedNotifyMessage = <MagicMock name='NotifyMessage' id='57274448'>
- @patch('praktikum.libs.notify.notify.NotifyMessage')
- def test_user_balance_check_fail(self, MockedNotifyMessage):
- user = User(id='53a191da9622a456a71d6e18', email='test@email.com',
- password='qwerty').save()
- self.assertUserBalance(user, '0', password='qwerty')
- invoice_id = 1234567
- sum_amount = '113.00'
- db_alias = DEFAULT_CONNECTION_NAME
- md5 = '366C3A25638E94DD7228DF2AFDACCD8D'
- purchased_id = '53a191da9622a456a71d6e12' # unexisting user
- data = self.get_yandex_check_data(user, invoice_id, user.id,
- sum_amount, sum_amount, db_alias, md5, purchased_id=purchased_id)
- # check
- post_data = urlencode(data)
- response = self.fetch(
- self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
- > self.assertEqual(200, response.code)
- E AssertionError: 200 != 405
- tests/test_payments_balance.py:879: AssertionError
- ------------------------------- Captured stderr --------------------------------
- WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 1.74ms
- _____ TestYandexNotificationPayments.test_check_already_signedin_forbidden _____
- self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_already_signedin_forbidden>
- def test_check_already_signedin_forbidden(self):
- self.create_brand_connection(db_alias=DEFAULT_CONNECTION_NAME)
- self.create_event_and_users(event_price=50)
- user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
- password='qwerty', participant=[self.event1.id]).save()
- md5 = '04F50B5EDD84F0CB4D30453E3397546B'
- > self._check_fail(DEFAULT_CONNECTION_NAME, md5, user=user)
- tests/test_payments_event.py:300:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- args = (<tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_already_signedin_forbidden>, 'default', '04F50B5EDD84F0CB4D30453E3397546B', <MagicMock name='NotifyMessage' id='67747984'>)
- keywargs = {'user': <User: test@email.com>}
- extra_args = [<MagicMock name='NotifyMessage' id='67747984'>]
- entered_patchers = [<mock._patch object at 0x2f98710>]
- exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x40a6128>)
- patching = <mock._patch object at 0x2f98710>
- arg = <MagicMock name='NotifyMessage' id='67747984'>
- @wraps(func)
- def patched(*args, **keywargs):
- # don't use a with here (backwards compatability with Python 2.4)
- extra_args = []
- entered_patchers = []
- # can't use try...except...finally because of Python 2.4
- # compatibility
- exc_info = tuple()
- try:
- try:
- for patching in patched.patchings:
- arg = patching.__enter__()
- entered_patchers.append(patching)
- if patching.attribute_name is not None:
- keywargs.update(arg)
- elif patching.new is DEFAULT:
- extra_args.append(arg)
- args += tuple(extra_args)
- > return func(*args, **keywargs)
- .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_already_signedin_forbidden>
- db_alias = 'default', md5 = '04F50B5EDD84F0CB4D30453E3397546B'
- MockedNotifyMessage = <MagicMock name='NotifyMessage' id='67747984'>
- kwargs = {'user': <User: test@email.com>}, user = <User: test@email.com>
- invoice_id = 1234567, sum_amount = 50
- data = {'action': 'checkOrder', 'brand_db_alias': 'default', 'customerNumber': '53a191da9622a456a71d6e1d', 'invoiceId': 1234567, ...}
- post_data = 'invoiceId=1234567&orderSumBankPaycash=1001&purchased_id=53d62d7cab592a31c97c496d&paymentType=AC&purchased_type=Event&...a191da9622a456a71d6e1d&orderCreatedDatetime=2011-05-04T20%3A38%3A00.000%2B04%3A00&md5=04F50B5EDD84F0CB4D30453E3397546B'
- @patch('praktikum.libs.notify.notify.NotifyMessage')
- def _check_fail(self, db_alias, md5, MockedNotifyMessage, **kwargs):
- user = kwargs.get('user')
- if not user:
- user = User(id='53a191da9622a456a71d6e1d', email='test@email.com', password='qwerty').save()
- invoice_id = 1234567
- sum_amount = self.event1.price
- data = self.get_yandex_check_data(self.event1, invoice_id, user.id,
- sum_amount, sum_amount, db_alias, md5, **kwargs)
- # check
- post_data = urlencode(data)
- response = self.fetch(
- self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
- > self.assertEqual(200, response.code)
- E AssertionError: 200 != 405
- tests/test_payments_event.py:370: AssertionError
- ------------------------------- Captured stderr --------------------------------
- WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.33ms
- _______ TestYandexNotificationPayments.test_check_and_aviso_child_brand ________
- self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_child_brand>
- def test_check_and_aviso_child_brand(self):
- self.create_brand_connection(db_alias='brand_test_alias')
- self.create_event_and_users(event_price=112)
- self.reset_db_alias()
- > self._check_and_aviso(self._brands[0].db_alias)
- tests/test_payments_event.py:273:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- args = (<tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_child_brand>, 'brand_test_alias', <MagicMock name='NotifyMessage' id='58655824'>)
- keywargs = {}, extra_args = [<MagicMock name='NotifyMessage' id='58655824'>]
- entered_patchers = [<mock._patch object at 0x2f98610>]
- exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x4098d88>)
- patching = <mock._patch object at 0x2f98610>
- arg = <MagicMock name='NotifyMessage' id='58655824'>
- @wraps(func)
- def patched(*args, **keywargs):
- # don't use a with here (backwards compatability with Python 2.4)
- extra_args = []
- entered_patchers = []
- # can't use try...except...finally because of Python 2.4
- # compatibility
- exc_info = tuple()
- try:
- try:
- for patching in patched.patchings:
- arg = patching.__enter__()
- entered_patchers.append(patching)
- if patching.attribute_name is not None:
- keywargs.update(arg)
- elif patching.new is DEFAULT:
- extra_args.append(arg)
- args += tuple(extra_args)
- > return func(*args, **keywargs)
- .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_child_brand>
- db_alias = 'brand_test_alias'
- MockedNotifyMessage = <MagicMock name='NotifyMessage' id='58655824'>
- @patch('praktikum.libs.notify.notify.NotifyMessage')
- def _check_and_aviso(self, db_alias, MockedNotifyMessage):
- with switch_db(User, db_alias):
- user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
- password='qwerty').save()
- invoice_id = 1234567
- sum_amount = self.event1.price
- md5 = '787614F67D2C14C507F1D9BC9D4C14AC'
- data = self.get_yandex_check_data(self.event1, invoice_id, user.id,
- sum_amount, sum_amount, db_alias, md5)
- # check
- post_data = urlencode(data)
- response = self.fetch(
- self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
- t = self.assertYandexNotificationResponseValid(response, invoice_id, db_alias,
- T.PAY_STATUS.started, "checkOrder", "checkOrderResponse",
- > sum_amount, self.event1)
- tests/test_payments_event.py:318:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_child_brand>
- response = HTTPResponse(_body=None,buffer=<_io.BytesIO object at 0x3566ef0>,code=405,effe...TTPRequest object at 0x40bd750>,request_time=0.004275083541870117,time_info={})
- invoice_id = 1234567, db_alias = 'brand_test_alias', pay_status = 'started'
- action = 'checkOrder', xml_action = 'checkOrderResponse', sum_amount = 112
- payed_item = <Event: Мероприятие "Бизнес">
- def assertYandexNotificationResponseValid(self, response, invoice_id, db_alias, pay_status,
- action, xml_action, sum_amount, payed_item):
- > self.assertEqual(200, response.code)
- E AssertionError: 200 != 405
- tests/test_payments_event.py:141: AssertionError
- ------------------------------- Captured stderr --------------------------------
- WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.26ms
- ________ TestYandexNotificationPayments.test_check_and_aviso_root_brand ________
- self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_root_brand>
- def test_check_and_aviso_root_brand(self):
- self.create_brand_connection(db_alias=DEFAULT_CONNECTION_NAME)
- self.create_event_and_users(event_price=112)
- > self._check_and_aviso(DEFAULT_CONNECTION_NAME)
- tests/test_payments_event.py:278:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- args = (<tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_root_brand>, 'default', <MagicMock name='NotifyMessage' id='69903760'>)
- keywargs = {}, extra_args = [<MagicMock name='NotifyMessage' id='69903760'>]
- entered_patchers = [<mock._patch object at 0x2f98610>]
- exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x4a96248>)
- patching = <mock._patch object at 0x2f98610>
- arg = <MagicMock name='NotifyMessage' id='69903760'>
- @wraps(func)
- def patched(*args, **keywargs):
- # don't use a with here (backwards compatability with Python 2.4)
- extra_args = []
- entered_patchers = []
- # can't use try...except...finally because of Python 2.4
- # compatibility
- exc_info = tuple()
- try:
- try:
- for patching in patched.patchings:
- arg = patching.__enter__()
- entered_patchers.append(patching)
- if patching.attribute_name is not None:
- keywargs.update(arg)
- elif patching.new is DEFAULT:
- extra_args.append(arg)
- args += tuple(extra_args)
- > return func(*args, **keywargs)
- .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_root_brand>
- db_alias = 'default'
- MockedNotifyMessage = <MagicMock name='NotifyMessage' id='69903760'>
- @patch('praktikum.libs.notify.notify.NotifyMessage')
- def _check_and_aviso(self, db_alias, MockedNotifyMessage):
- with switch_db(User, db_alias):
- user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
- password='qwerty').save()
- invoice_id = 1234567
- sum_amount = self.event1.price
- md5 = '787614F67D2C14C507F1D9BC9D4C14AC'
- data = self.get_yandex_check_data(self.event1, invoice_id, user.id,
- sum_amount, sum_amount, db_alias, md5)
- # check
- post_data = urlencode(data)
- response = self.fetch(
- self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
- t = self.assertYandexNotificationResponseValid(response, invoice_id, db_alias,
- T.PAY_STATUS.started, "checkOrder", "checkOrderResponse",
- > sum_amount, self.event1)
- tests/test_payments_event.py:318:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_root_brand>
- response = HTTPResponse(_body=None,buffer=<_io.BytesIO object at 0x2f2f530>,code=405,effe...TTPRequest object at 0x42a9b10>,request_time=0.004920005798339844,time_info={})
- invoice_id = 1234567, db_alias = 'default', pay_status = 'started'
- action = 'checkOrder', xml_action = 'checkOrderResponse', sum_amount = 112
- payed_item = <Event: Мероприятие "Бизнес">
- def assertYandexNotificationResponseValid(self, response, invoice_id, db_alias, pay_status,
- action, xml_action, sum_amount, payed_item):
- > self.assertEqual(200, response.code)
- E AssertionError: 200 != 405
- tests/test_payments_event.py:141: AssertionError
- ------------------------------- Captured stderr --------------------------------
- WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 3.08ms
- ________________ TestYandexNotificationPayments.test_check_fail ________________
- self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_fail>
- def test_check_fail(self):
- self.create_brand_connection(db_alias='brand_test_alias')
- self.create_event_and_users(event_price=112)
- md5 = '787614F67D2C14C507F1D9BC9D4C14AC'
- bad_purchased_id = '53a191da9622a456a71d6e1d'
- > self._check_fail(self._brands[0].db_alias, md5, purchased_id=bad_purchased_id)
- tests/test_payments_event.py:285:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- args = (<tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_fail>, 'brand_test_alias', '787614F67D2C14C507F1D9BC9D4C14AC', <MagicMock name='NotifyMessage' id='60168144'>)
- keywargs = {'purchased_id': '53a191da9622a456a71d6e1d'}
- extra_args = [<MagicMock name='NotifyMessage' id='60168144'>]
- entered_patchers = [<mock._patch object at 0x2f98710>]
- exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x36a4488>)
- patching = <mock._patch object at 0x2f98710>
- arg = <MagicMock name='NotifyMessage' id='60168144'>
- @wraps(func)
- def patched(*args, **keywargs):
- # don't use a with here (backwards compatability with Python 2.4)
- extra_args = []
- entered_patchers = []
- # can't use try...except...finally because of Python 2.4
- # compatibility
- exc_info = tuple()
- try:
- try:
- for patching in patched.patchings:
- arg = patching.__enter__()
- entered_patchers.append(patching)
- if patching.attribute_name is not None:
- keywargs.update(arg)
- elif patching.new is DEFAULT:
- extra_args.append(arg)
- args += tuple(extra_args)
- > return func(*args, **keywargs)
- .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_fail>
- db_alias = 'brand_test_alias', md5 = '787614F67D2C14C507F1D9BC9D4C14AC'
- MockedNotifyMessage = <MagicMock name='NotifyMessage' id='60168144'>
- kwargs = {'purchased_id': '53a191da9622a456a71d6e1d'}
- user = <User: test@email.com>, invoice_id = 1234567, sum_amount = 112
- data = {'action': 'checkOrder', 'brand_db_alias': 'brand_test_alias', 'customerNumber': '53a191da9622a456a71d6e1d', 'invoiceId': 1234567, ...}
- post_data = 'invoiceId=1234567&orderSumBankPaycash=1001&purchased_id=53a191da9622a456a71d6e1d&paymentType=AC&purchased_type=Event&...a191da9622a456a71d6e1d&orderCreatedDatetime=2011-05-04T20%3A38%3A00.000%2B04%3A00&md5=787614F67D2C14C507F1D9BC9D4C14AC'
- @patch('praktikum.libs.notify.notify.NotifyMessage')
- def _check_fail(self, db_alias, md5, MockedNotifyMessage, **kwargs):
- user = kwargs.get('user')
- if not user:
- user = User(id='53a191da9622a456a71d6e1d', email='test@email.com', password='qwerty').save()
- invoice_id = 1234567
- sum_amount = self.event1.price
- data = self.get_yandex_check_data(self.event1, invoice_id, user.id,
- sum_amount, sum_amount, db_alias, md5, **kwargs)
- # check
- post_data = urlencode(data)
- response = self.fetch(
- self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
- > self.assertEqual(200, response.code)
- E AssertionError: 200 != 405
- tests/test_payments_event.py:370: AssertionError
- ------------------------------- Captured stderr --------------------------------
- WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.90ms
- __________ TestYandexNotificationPayments.test_check_fail_root_brand ___________
- self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_fail_root_brand>
- def test_check_fail_root_brand(self):
- self.create_brand_connection(db_alias=DEFAULT_CONNECTION_NAME)
- self.create_event_and_users(event_price=112)
- md5 = '787614F67D2C14C507F1D9BC9D4C14AC'
- bad_purchased_id = '53a191da9622a456a71d6e1d'
- > self._check_fail(DEFAULT_CONNECTION_NAME, md5, purchased_id=bad_purchased_id)
- tests/test_payments_event.py:292:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- args = (<tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_fail_root_brand>, 'default', '787614F67D2C14C507F1D9BC9D4C14AC', <MagicMock name='NotifyMessage' id='69934992'>)
- keywargs = {'purchased_id': '53a191da9622a456a71d6e1d'}
- extra_args = [<MagicMock name='NotifyMessage' id='69934992'>]
- entered_patchers = [<mock._patch object at 0x2f98710>]
- exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x47907e8>)
- patching = <mock._patch object at 0x2f98710>
- arg = <MagicMock name='NotifyMessage' id='69934992'>
- @wraps(func)
- def patched(*args, **keywargs):
- # don't use a with here (backwards compatability with Python 2.4)
- extra_args = []
- entered_patchers = []
- # can't use try...except...finally because of Python 2.4
- # compatibility
- exc_info = tuple()
- try:
- try:
- for patching in patched.patchings:
- arg = patching.__enter__()
- entered_patchers.append(patching)
- if patching.attribute_name is not None:
- keywargs.update(arg)
- elif patching.new is DEFAULT:
- extra_args.append(arg)
- args += tuple(extra_args)
- > return func(*args, **keywargs)
- .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_fail_root_brand>
- db_alias = 'default', md5 = '787614F67D2C14C507F1D9BC9D4C14AC'
- MockedNotifyMessage = <MagicMock name='NotifyMessage' id='69934992'>
- kwargs = {'purchased_id': '53a191da9622a456a71d6e1d'}
- user = <User: test@email.com>, invoice_id = 1234567, sum_amount = 112
- data = {'action': 'checkOrder', 'brand_db_alias': 'default', 'customerNumber': '53a191da9622a456a71d6e1d', 'invoiceId': 1234567, ...}
- post_data = 'invoiceId=1234567&orderSumBankPaycash=1001&purchased_id=53a191da9622a456a71d6e1d&paymentType=AC&purchased_type=Event&...a191da9622a456a71d6e1d&orderCreatedDatetime=2011-05-04T20%3A38%3A00.000%2B04%3A00&md5=787614F67D2C14C507F1D9BC9D4C14AC'
- @patch('praktikum.libs.notify.notify.NotifyMessage')
- def _check_fail(self, db_alias, md5, MockedNotifyMessage, **kwargs):
- user = kwargs.get('user')
- if not user:
- user = User(id='53a191da9622a456a71d6e1d', email='test@email.com', password='qwerty').save()
- invoice_id = 1234567
- sum_amount = self.event1.price
- data = self.get_yandex_check_data(self.event1, invoice_id, user.id,
- sum_amount, sum_amount, db_alias, md5, **kwargs)
- # check
- post_data = urlencode(data)
- response = self.fetch(
- self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
- > self.assertEqual(200, response.code)
- E AssertionError: 200 != 405
- tests/test_payments_event.py:370: AssertionError
- ------------------------------- Captured stderr --------------------------------
- WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.24ms
- ____ TestYandexNotificationPlan.test_plan_check_amount_unlimited_forbidden _____
- self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_amount_unlimited_forbidden>
- def test_plan_check_amount_unlimited_forbidden(self):
- db_alias = DEFAULT_CONNECTION_NAME
- self.create_brand_connection(db_alias=db_alias)
- plan = self.create_plan(u"Платный", is_default=False, price=208,
- is_unlimited=True)
- user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
- password='qwerty', plan={'plan': plan.id})
- user.save()
- invoice_id = 2234567
- amount = 5
- sum_amount = plan.price*amount
- md5_check = 'CD6FC329680877549B4DEC339E2E4818'
- data = self.get_yandex_check_data(plan, invoice_id, user.id,
- sum_amount, sum_amount, db_alias, md5_check, amount=5)
- # check
- post_data = urlencode(data)
- response = self.fetch(
- self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
- > self.assertTrue('code="100"' in response.body)
- E AssertionError: False is not true
- tests/test_payments_plan.py:566: AssertionError
- ------------------------------- Captured stderr --------------------------------
- WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.43ms
- _____________ TestYandexNotificationPlan.test_plan_check_and_aviso _____________
- self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso>
- def test_plan_check_and_aviso(self):
- sum_amount = 208
- plan_data = dict(title=u"Платный", is_default=False, price=sum_amount,
- max_conferences=10, max_users_per_conference=500)
- md5_check = '27518523EC25145A66B0305353941F5E'
- md5_aviso = '88B57D8BC680A73D8580FDDE64B79AA0'
- > self._plan_check_and_aviso(plan_data, sum_amount, md5_check, md5_aviso, amount=1)
- tests/test_payments_plan.py:458:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- args = (<tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso>, {'is_default': False, 'ma..._per_conference': 500, 'price': 208, ...}, 208, '27518523EC25145A66B0305353941F5E', '88B57D8BC680A73D8580FDDE64B79AA0')
- kw = {'amount': 1}
- @wraps(f)
- def _inner(*args, **kw):
- self._patch_dict()
- try:
- > return f(*args, **kw)
- .pyenv/local/lib/python2.7/site-packages/mock.py:1618:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- args = (<tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso>, {'is_default': False, 'ma...8523EC25145A66B0305353941F5E', '88B57D8BC680A73D8580FDDE64B79AA0', <MagicMock name='NotifyMessage' id='75086032'>, ...)
- keywargs = {'amount': 1}
- extra_args = [<MagicMock name='NotifyMessage' id='75086032'>, <MagicMock name='imind' id='75159952'>]
- entered_patchers = [<mock._patch object at 0x2f90fd0>, <mock._patch object at 0x2f90f50>]
- exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x44a0ea8>)
- patching = <mock._patch object at 0x2f90fd0>
- arg = <MagicMock name='imind' id='75159952'>
- @wraps(func)
- def patched(*args, **keywargs):
- # don't use a with here (backwards compatability with Python 2.4)
- extra_args = []
- entered_patchers = []
- # can't use try...except...finally because of Python 2.4
- # compatibility
- exc_info = tuple()
- try:
- try:
- for patching in patched.patchings:
- arg = patching.__enter__()
- entered_patchers.append(patching)
- if patching.attribute_name is not None:
- keywargs.update(arg)
- elif patching.new is DEFAULT:
- extra_args.append(arg)
- args += tuple(extra_args)
- > return func(*args, **keywargs)
- .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso>
- plan_data = {'is_default': False, 'max_conferences': 10, 'max_users_per_conference': 500, 'price': 208, ...}
- sum_amount = 208, md5_check = '27518523EC25145A66B0305353941F5E'
- md5_aviso = '88B57D8BC680A73D8580FDDE64B79AA0'
- MockedNotifyMessage = <MagicMock name='NotifyMessage' id='75086032'>
- m_imind = <MagicMock name='imind' id='75159952'>, amount = 1
- db_alias = 'default'
- @patch.dict(settings, {'debug': False})
- @patch.object(iMindMixin, 'imind')
- @patch('praktikum.libs.notify.notify.NotifyMessage')
- def _plan_check_and_aviso(self, plan_data, sum_amount, md5_check, md5_aviso,
- MockedNotifyMessage, m_imind, amount=1, db_alias=DEFAULT_CONNECTION_NAME):
- m_imind.domain_administration.add_user.side_effect = mocked_imind_add_user
- m_imind.domain_administration.get_subscription.side_effect = mocked_imind_get_subscription
- self.create_brand_connection(db_alias=db_alias)
- plan = self.create_plan(**plan_data)
- user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
- password='qwerty', plan={'plan': plan.id})
- user.save()
- invoice_id = 2234567
- data = self.get_yandex_check_data(plan, invoice_id, user.id,
- sum_amount, sum_amount, db_alias, md5_check, amount)
- # check
- post_data = urlencode(data)
- response = self.fetch(
- self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
- t = self.assertYandexNotificationResponseValid(response, invoice_id, db_alias,
- T.PAY_STATUS.started, "checkOrder", "checkOrderResponse",
- > sum_amount, plan)
- tests/test_payments_plan.py:590:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso>
- response = HTTPResponse(_body=None,buffer=<_io.BytesIO object at 0x47a9c50>,code=405,effe...TPRequest object at 0x47b9910>,request_time=0.0039789676666259766,time_info={})
- invoice_id = 2234567, db_alias = 'default', pay_status = 'started'
- action = 'checkOrder', xml_action = 'checkOrderResponse', sum_amount = 208
- payed_item = <Plan: Тариф "Платный">
- def assertYandexNotificationResponseValid(self, response, invoice_id, db_alias, pay_status,
- action, xml_action, sum_amount, payed_item):
- > self.assertEqual(200, response.code)
- E AssertionError: 200 != 405
- tests/test_payments_event.py:141: AssertionError
- ------------------------------- Captured stderr --------------------------------
- WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.13ms
- ________ TestYandexNotificationPlan.test_plan_check_and_aviso_duration _________
- self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso_duration>
- def test_plan_check_and_aviso_duration(self):
- price = 208
- amount = 8
- sum_amount = str(D(price*amount) * D('0.85'))
- plan_data = dict(title=u"Платный", is_default=False, price=price,
- max_conferences=10, max_users_per_conference=500,
- discounts={"3": 10, "6": 15, "12": 30})
- md5_check = 'C869A48CB4FB925180C0DE84347A200C'
- md5_aviso = '40935F5A8D3387380401614FDD8CC041'
- > self._plan_check_and_aviso(plan_data, sum_amount, md5_check, md5_aviso, amount=amount)
- tests/test_payments_plan.py:469:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- args = (<tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso_duration>, {'discounts': {'...ax_users_per_conference': 500, ...}, '1414.40', 'C869A48CB4FB925180C0DE84347A200C', '40935F5A8D3387380401614FDD8CC041')
- kw = {'amount': 8}
- @wraps(f)
- def _inner(*args, **kw):
- self._patch_dict()
- try:
- > return f(*args, **kw)
- .pyenv/local/lib/python2.7/site-packages/mock.py:1618:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- args = (<tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso_duration>, {'discounts': {'...A48CB4FB925180C0DE84347A200C', '40935F5A8D3387380401614FDD8CC041', <MagicMock name='NotifyMessage' id='75152976'>, ...)
- keywargs = {'amount': 8}
- extra_args = [<MagicMock name='NotifyMessage' id='75152976'>, <MagicMock name='imind' id='74965584'>]
- entered_patchers = [<mock._patch object at 0x2f90fd0>, <mock._patch object at 0x2f90f50>]
- exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x4aa9bd8>)
- patching = <mock._patch object at 0x2f90fd0>
- arg = <MagicMock name='imind' id='74965584'>
- @wraps(func)
- def patched(*args, **keywargs):
- # don't use a with here (backwards compatability with Python 2.4)
- extra_args = []
- entered_patchers = []
- # can't use try...except...finally because of Python 2.4
- # compatibility
- exc_info = tuple()
- try:
- try:
- for patching in patched.patchings:
- arg = patching.__enter__()
- entered_patchers.append(patching)
- if patching.attribute_name is not None:
- keywargs.update(arg)
- elif patching.new is DEFAULT:
- extra_args.append(arg)
- args += tuple(extra_args)
- > return func(*args, **keywargs)
- .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso_duration>
- plan_data = {'discounts': {'12': 30, '3': 10, '6': 15}, 'is_default': False, 'max_conferences': 10, 'max_users_per_conference': 500, ...}
- sum_amount = '1414.40', md5_check = 'C869A48CB4FB925180C0DE84347A200C'
- md5_aviso = '40935F5A8D3387380401614FDD8CC041'
- MockedNotifyMessage = <MagicMock name='NotifyMessage' id='75152976'>
- m_imind = <MagicMock name='imind' id='74965584'>, amount = 8
- db_alias = 'default'
- @patch.dict(settings, {'debug': False})
- @patch.object(iMindMixin, 'imind')
- @patch('praktikum.libs.notify.notify.NotifyMessage')
- def _plan_check_and_aviso(self, plan_data, sum_amount, md5_check, md5_aviso,
- MockedNotifyMessage, m_imind, amount=1, db_alias=DEFAULT_CONNECTION_NAME):
- m_imind.domain_administration.add_user.side_effect = mocked_imind_add_user
- m_imind.domain_administration.get_subscription.side_effect = mocked_imind_get_subscription
- self.create_brand_connection(db_alias=db_alias)
- plan = self.create_plan(**plan_data)
- user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
- password='qwerty', plan={'plan': plan.id})
- user.save()
- invoice_id = 2234567
- data = self.get_yandex_check_data(plan, invoice_id, user.id,
- sum_amount, sum_amount, db_alias, md5_check, amount)
- # check
- post_data = urlencode(data)
- response = self.fetch(
- self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
- t = self.assertYandexNotificationResponseValid(response, invoice_id, db_alias,
- T.PAY_STATUS.started, "checkOrder", "checkOrderResponse",
- > sum_amount, plan)
- tests/test_payments_plan.py:590:
- _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
- self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso_duration>
- response = HTTPResponse(_body=None,buffer=<_io.BytesIO object at 0x47a9f50>,code=405,effe...TTPRequest object at 0x4786f50>,request_time=0.004055023193359375,time_info={})
- invoice_id = 2234567, db_alias = 'default', pay_status = 'started'
- action = 'checkOrder', xml_action = 'checkOrderResponse', sum_amount = '1414.40'
- payed_item = <Plan: Тариф "Платный">
- def assertYandexNotificationResponseValid(self, response, invoice_id, db_alias, pay_status,
- action, xml_action, sum_amount, payed_item):
- > self.assertEqual(200, response.code)
- E AssertionError: 200 != 405
- tests/test_payments_event.py:141: AssertionError
- ------------------------------- Captured stderr --------------------------------
- WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.16ms
- TestYandexNotificationPlan.test_plan_check_and_aviso_duration_bad_price_forbidden
- self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso_duration_bad_price_forbidden>
- def test_plan_check_and_aviso_duration_bad_price_forbidden(self):
- db_alias = DEFAULT_CONNECTION_NAME
- self.create_brand_connection(db_alias=db_alias)
- plan = self.create_plan(u"Платный", is_default=False, price=208,
- discounts={"3": 10, "6": 15, "12": 30})
- user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
- password='qwerty', plan={'plan': plan.id})
- user.save()
- invoice_id = 2234567
- amount = 8
- sum_amount = plan.price * amount
- md5_check = '2EA6E898E8081204A30399E733DAC9D6'
- data = self.get_yandex_check_data(plan, invoice_id, user.id,
- sum_amount, sum_amount, db_alias, md5_check, amount)
- # check
- post_data = urlencode(data)
- response = self.fetch(
- self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
- > self.assertTrue('code="100"' in response.body)
- E AssertionError: False is not true
- tests/test_payments_plan.py:526: AssertionError
- ------------------------------- Captured stderr --------------------------------
- WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.64ms
- ______ TestYandexNotificationPlan.test_plan_check_another_payed_forbidden ______
- self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_another_payed_forbidden>
- def test_plan_check_another_payed_forbidden(self):
- self.create_brand_connection(db_alias=DEFAULT_CONNECTION_NAME)
- payed_plan1 = self.create_plan(is_default=False, price=100)
- payed_plan2 = self.create_plan(is_default=False, price=200)
- user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
- password='qwerty', plan={'plan': payed_plan1.id})
- user.save()
- sum_amount = payed_plan2.price
- amount = 1
- data = self.get_yandex_check_data(payed_plan2, 2234567, user.id,
- sum_amount, sum_amount, DEFAULT_CONNECTION_NAME,
- 'B5FC591F028FBB6C33CAFFF3D5E309F1', amount)
- post_data = urlencode(data)
- response = self.fetch(
- self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
- > self.assertTrue('code="100"' in response.body)
- E AssertionError: False is not true
- tests/test_payments_plan.py:505: AssertionError
- ------------------------------- Captured stderr --------------------------------
- WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.13ms
- __________ TestYandexNotificationPlan.test_plan_check_free_forbidden ___________
- self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_free_forbidden>
- def test_plan_check_free_forbidden(self):
- self.create_brand_connection(db_alias=DEFAULT_CONNECTION_NAME)
- default_plan = self.create_plan(u"Базовый")
- free_plan = self.create_plan(u"Беспалтный", is_default=False)
- user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
- password='qwerty', plan={'plan': default_plan.id})
- user.save()
- sum_amount = free_plan.price
- amount = 1
- data = self.get_yandex_check_data(free_plan, 2234567, user.id,
- sum_amount, sum_amount, DEFAULT_CONNECTION_NAME,
- 'C486E8CF2A360022E33D9F228A4F9B67', amount)
- # check denies free plan
- post_data = urlencode(data)
- response = self.fetch(
- self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
- > self.assertTrue('code="100"' in response.body)
- E AssertionError: False is not true
- tests/test_payments_plan.py:488: AssertionError
- ------------------------------- Captured stderr --------------------------------
- WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.16ms
- _____ TestYandexNotificationPlan.test_plan_check_payed_unlimited_forbidden _____
- self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_payed_unlimited_forbidden>
- def test_plan_check_payed_unlimited_forbidden(self):
- db_alias = DEFAULT_CONNECTION_NAME
- self.create_brand_connection(db_alias=db_alias)
- plan = self.create_plan(u"Платный", is_default=False, price=208,
- is_unlimited=True)
- user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
- password='qwerty', plan={'plan': plan.id, 'is_payed': True})
- user.save()
- invoice_id = 2234567
- sum_amount = plan.price
- md5_check = '27518523EC25145A66B0305353941F5E'
- data = self.get_yandex_check_data(plan, invoice_id, user.id,
- sum_amount, sum_amount, db_alias, md5_check, amount=1)
- # check
- post_data = urlencode(data)
- response = self.fetch(
- self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
- > self.assertTrue('code="100"' in response.body)
- E AssertionError: False is not true
- tests/test_payments_plan.py:546: AssertionError
- ------------------------------- Captured stderr --------------------------------
- WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.18ms
- generated xml file: /var/lib/jenkins/jobs/praktikum_production/workspace/junit.xml
- =================== 14 failed, 128 passed in 401.26 seconds ====================
- Build step 'Execute shell' marked build as failure
- Recording test results
- Finished: FAILURE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement