Advertisement
Guest User

Untitled

a guest
Jul 28th, 2014
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 46.84 KB | None | 0 0
  1. + py.test tests --junitxml=./junit.xml
  2. ============================= test session starts ==============================
  3. platform linux2 -- Python 2.7.3 -- py-1.4.22 -- pytest-2.5.2
  4. collected 142 items
  5.  
  6. tests/test_brand.py .........
  7. tests/test_crud.py .....................
  8. tests/test_event.py .....
  9. tests/test_mailer.py .......
  10. tests/test_payments_balance.py ....................................FF..
  11. tests/test_payments_event.py .....FFFFF...
  12. tests/test_payments_plan.py ..............FFFFFFF....
  13. tests/test_payments_transaction.py ........
  14. tests/test_recordings.py ....
  15. tests/test_topics.py .....
  16. tests/test_user.py .....
  17.  
  18. =================================== FAILURES ===================================
  19. ____________ TestUserBalanceTopup.test_user_balance_check_and_aviso ____________
  20.  
  21. args = (<tests.test_payments_balance.TestUserBalanceTopup testMethod=test_user_balance_check_and_aviso>, <MagicMock name='NotifyMessage' id='60182800'>)
  22. keywargs = {}, extra_args = [<MagicMock name='NotifyMessage' id='60182800'>]
  23. entered_patchers = [<mock._patch object at 0x2f98b50>]
  24. exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x3039290>)
  25. patching = <mock._patch object at 0x2f98b50>
  26. arg = <MagicMock name='NotifyMessage' id='60182800'>
  27.  
  28.     @wraps(func)
  29.     def patched(*args, **keywargs):
  30.         # don't use a with here (backwards compatability with Python 2.4)
  31.         extra_args = []
  32.         entered_patchers = []
  33.    
  34.         # can't use try...except...finally because of Python 2.4
  35.         # compatibility
  36.         exc_info = tuple()
  37.         try:
  38.             try:
  39.                 for patching in patched.patchings:
  40.                     arg = patching.__enter__()
  41.                     entered_patchers.append(patching)
  42.                     if patching.attribute_name is not None:
  43.                         keywargs.update(arg)
  44.                     elif patching.new is DEFAULT:
  45.                         extra_args.append(arg)
  46.    
  47.                 args += tuple(extra_args)
  48. >               return func(*args, **keywargs)
  49.  
  50. .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
  51. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  52.  
  53. self = <tests.test_payments_balance.TestUserBalanceTopup testMethod=test_user_balance_check_and_aviso>
  54. MockedNotifyMessage = <MagicMock name='NotifyMessage' id='60182800'>
  55.  
  56.     @patch('praktikum.libs.notify.notify.NotifyMessage')
  57.     def test_user_balance_check_and_aviso(self, MockedNotifyMessage):
  58.             user = User(id='53a191da9622a456a71d6e18', email='test@email.com',
  59.                     password='qwerty').save()
  60.             self.add_to_balance(user, 50)
  61.             invoice_id = 1234567
  62.             sum_amount = '148'
  63.             shop_sum_amount = '143'  # payment system commissions
  64.             db_alias = DEFAULT_CONNECTION_NAME
  65.             # check
  66.             md5 = '0FA2C2E09694F008D67C04FE5C70C50B'
  67.             data = self.get_yandex_check_data(user, invoice_id, user.id,
  68.                     sum_amount, shop_sum_amount, db_alias, md5)
  69.             post_data = urlencode(data)
  70.             response = self.fetch(self.get_url('/api/payments/yandex/chek'),
  71.                     method="POST", body=post_data)
  72.             self.assertYandexNotificationResponseValid(response, invoice_id, db_alias,
  73.                     T.PAY_STATUS.started, "checkOrder", "checkOrderResponse",
  74. >                   sum_amount, user)
  75.  
  76. tests/test_payments_balance.py:842:
  77. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  78.  
  79. self = <tests.test_payments_balance.TestUserBalanceTopup testMethod=test_user_balance_check_and_aviso>
  80. response = HTTPResponse(_body=None,buffer=<_io.BytesIO object at 0x2b8ffb0>,code=405,effe...TPRequest object at 0x301f250>,request_time=0.0040798187255859375,time_info={})
  81. invoice_id = 1234567, db_alias = 'default', pay_status = 'started'
  82. action = 'checkOrder', xml_action = 'checkOrderResponse', sum_amount = '148'
  83. payed_item = <User: test@email.com>
  84.  
  85.     def assertYandexNotificationResponseValid(self, response, invoice_id, db_alias, pay_status,
  86.                     action, xml_action, sum_amount, payed_item):
  87. >           self.assertEqual(200, response.code)
  88. E           AssertionError: 200 != 405
  89.  
  90. tests/test_payments_event.py:141: AssertionError
  91. ------------------------------- Captured stderr --------------------------------
  92. WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.23ms
  93. ______________ TestUserBalanceTopup.test_user_balance_check_fail _______________
  94.  
  95. args = (<tests.test_payments_balance.TestUserBalanceTopup testMethod=test_user_balance_check_fail>, <MagicMock name='NotifyMessage' id='57274448'>)
  96. keywargs = {}, extra_args = [<MagicMock name='NotifyMessage' id='57274448'>]
  97. entered_patchers = [<mock._patch object at 0x2f98c90>]
  98. exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x2b91758>)
  99. patching = <mock._patch object at 0x2f98c90>
  100. arg = <MagicMock name='NotifyMessage' id='57274448'>
  101.  
  102.     @wraps(func)
  103.     def patched(*args, **keywargs):
  104.         # don't use a with here (backwards compatability with Python 2.4)
  105.         extra_args = []
  106.         entered_patchers = []
  107.    
  108.         # can't use try...except...finally because of Python 2.4
  109.         # compatibility
  110.         exc_info = tuple()
  111.         try:
  112.             try:
  113.                 for patching in patched.patchings:
  114.                     arg = patching.__enter__()
  115.                     entered_patchers.append(patching)
  116.                     if patching.attribute_name is not None:
  117.                         keywargs.update(arg)
  118.                     elif patching.new is DEFAULT:
  119.                         extra_args.append(arg)
  120.    
  121.                 args += tuple(extra_args)
  122. >               return func(*args, **keywargs)
  123.  
  124. .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
  125. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  126.  
  127. self = <tests.test_payments_balance.TestUserBalanceTopup testMethod=test_user_balance_check_fail>
  128. MockedNotifyMessage = <MagicMock name='NotifyMessage' id='57274448'>
  129.  
  130.     @patch('praktikum.libs.notify.notify.NotifyMessage')
  131.     def test_user_balance_check_fail(self, MockedNotifyMessage):
  132.             user = User(id='53a191da9622a456a71d6e18', email='test@email.com',
  133.                     password='qwerty').save()
  134.             self.assertUserBalance(user, '0', password='qwerty')
  135.             invoice_id = 1234567
  136.             sum_amount = '113.00'
  137.             db_alias = DEFAULT_CONNECTION_NAME
  138.             md5 = '366C3A25638E94DD7228DF2AFDACCD8D'
  139.             purchased_id = '53a191da9622a456a71d6e12'  # unexisting user
  140.             data = self.get_yandex_check_data(user, invoice_id, user.id,
  141.                     sum_amount, sum_amount, db_alias, md5, purchased_id=purchased_id)
  142.             # check
  143.             post_data = urlencode(data)
  144.             response = self.fetch(
  145.                     self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
  146. >           self.assertEqual(200, response.code)
  147. E           AssertionError: 200 != 405
  148.  
  149. tests/test_payments_balance.py:879: AssertionError
  150. ------------------------------- Captured stderr --------------------------------
  151. WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 1.74ms
  152. _____ TestYandexNotificationPayments.test_check_already_signedin_forbidden _____
  153.  
  154. self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_already_signedin_forbidden>
  155.  
  156.     def test_check_already_signedin_forbidden(self):
  157.             self.create_brand_connection(db_alias=DEFAULT_CONNECTION_NAME)
  158.             self.create_event_and_users(event_price=50)
  159.             user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
  160.                     password='qwerty', participant=[self.event1.id]).save()
  161.             md5 = '04F50B5EDD84F0CB4D30453E3397546B'
  162. >           self._check_fail(DEFAULT_CONNECTION_NAME, md5, user=user)
  163.  
  164. tests/test_payments_event.py:300:
  165. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  166.  
  167. args = (<tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_already_signedin_forbidden>, 'default', '04F50B5EDD84F0CB4D30453E3397546B', <MagicMock name='NotifyMessage' id='67747984'>)
  168. keywargs = {'user': <User: test@email.com>}
  169. extra_args = [<MagicMock name='NotifyMessage' id='67747984'>]
  170. entered_patchers = [<mock._patch object at 0x2f98710>]
  171. exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x40a6128>)
  172. patching = <mock._patch object at 0x2f98710>
  173. arg = <MagicMock name='NotifyMessage' id='67747984'>
  174.  
  175.     @wraps(func)
  176.     def patched(*args, **keywargs):
  177.         # don't use a with here (backwards compatability with Python 2.4)
  178.         extra_args = []
  179.         entered_patchers = []
  180.    
  181.         # can't use try...except...finally because of Python 2.4
  182.         # compatibility
  183.         exc_info = tuple()
  184.         try:
  185.             try:
  186.                 for patching in patched.patchings:
  187.                     arg = patching.__enter__()
  188.                     entered_patchers.append(patching)
  189.                     if patching.attribute_name is not None:
  190.                         keywargs.update(arg)
  191.                     elif patching.new is DEFAULT:
  192.                         extra_args.append(arg)
  193.    
  194.                 args += tuple(extra_args)
  195. >               return func(*args, **keywargs)
  196.  
  197. .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
  198. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  199.  
  200. self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_already_signedin_forbidden>
  201. db_alias = 'default', md5 = '04F50B5EDD84F0CB4D30453E3397546B'
  202. MockedNotifyMessage = <MagicMock name='NotifyMessage' id='67747984'>
  203. kwargs = {'user': <User: test@email.com>}, user = <User: test@email.com>
  204. invoice_id = 1234567, sum_amount = 50
  205. data = {'action': 'checkOrder', 'brand_db_alias': 'default', 'customerNumber': '53a191da9622a456a71d6e1d', 'invoiceId': 1234567, ...}
  206. 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'
  207.  
  208.     @patch('praktikum.libs.notify.notify.NotifyMessage')
  209.     def _check_fail(self, db_alias, md5, MockedNotifyMessage, **kwargs):
  210.             user = kwargs.get('user')
  211.             if not user:
  212.                     user = User(id='53a191da9622a456a71d6e1d', email='test@email.com', password='qwerty').save()
  213.             invoice_id = 1234567
  214.             sum_amount = self.event1.price
  215.             data = self.get_yandex_check_data(self.event1, invoice_id, user.id,
  216.                     sum_amount, sum_amount, db_alias, md5, **kwargs)
  217.             # check
  218.             post_data = urlencode(data)
  219.             response = self.fetch(
  220.                     self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
  221. >           self.assertEqual(200, response.code)
  222. E           AssertionError: 200 != 405
  223.  
  224. tests/test_payments_event.py:370: AssertionError
  225. ------------------------------- Captured stderr --------------------------------
  226. WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.33ms
  227. _______ TestYandexNotificationPayments.test_check_and_aviso_child_brand ________
  228.  
  229. self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_child_brand>
  230.  
  231.     def test_check_and_aviso_child_brand(self):
  232.             self.create_brand_connection(db_alias='brand_test_alias')
  233.             self.create_event_and_users(event_price=112)
  234.             self.reset_db_alias()
  235. >           self._check_and_aviso(self._brands[0].db_alias)
  236.  
  237. tests/test_payments_event.py:273:
  238. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  239.  
  240. args = (<tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_child_brand>, 'brand_test_alias', <MagicMock name='NotifyMessage' id='58655824'>)
  241. keywargs = {}, extra_args = [<MagicMock name='NotifyMessage' id='58655824'>]
  242. entered_patchers = [<mock._patch object at 0x2f98610>]
  243. exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x4098d88>)
  244. patching = <mock._patch object at 0x2f98610>
  245. arg = <MagicMock name='NotifyMessage' id='58655824'>
  246.  
  247.     @wraps(func)
  248.     def patched(*args, **keywargs):
  249.         # don't use a with here (backwards compatability with Python 2.4)
  250.         extra_args = []
  251.         entered_patchers = []
  252.    
  253.         # can't use try...except...finally because of Python 2.4
  254.         # compatibility
  255.         exc_info = tuple()
  256.         try:
  257.             try:
  258.                 for patching in patched.patchings:
  259.                     arg = patching.__enter__()
  260.                     entered_patchers.append(patching)
  261.                     if patching.attribute_name is not None:
  262.                         keywargs.update(arg)
  263.                     elif patching.new is DEFAULT:
  264.                         extra_args.append(arg)
  265.    
  266.                 args += tuple(extra_args)
  267. >               return func(*args, **keywargs)
  268.  
  269. .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
  270. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  271.  
  272. self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_child_brand>
  273. db_alias = 'brand_test_alias'
  274. MockedNotifyMessage = <MagicMock name='NotifyMessage' id='58655824'>
  275.  
  276.     @patch('praktikum.libs.notify.notify.NotifyMessage')
  277.     def _check_and_aviso(self, db_alias, MockedNotifyMessage):
  278.             with switch_db(User, db_alias):
  279.                     user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
  280.                             password='qwerty').save()
  281.             invoice_id = 1234567
  282.             sum_amount = self.event1.price
  283.             md5 = '787614F67D2C14C507F1D9BC9D4C14AC'
  284.             data = self.get_yandex_check_data(self.event1, invoice_id, user.id,
  285.                     sum_amount, sum_amount, db_alias, md5)
  286.             # check
  287.             post_data = urlencode(data)
  288.             response = self.fetch(
  289.                     self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
  290.             t = self.assertYandexNotificationResponseValid(response, invoice_id, db_alias,
  291.                     T.PAY_STATUS.started, "checkOrder", "checkOrderResponse",
  292. >                   sum_amount, self.event1)
  293.  
  294. tests/test_payments_event.py:318:
  295. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  296.  
  297. self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_child_brand>
  298. response = HTTPResponse(_body=None,buffer=<_io.BytesIO object at 0x3566ef0>,code=405,effe...TTPRequest object at 0x40bd750>,request_time=0.004275083541870117,time_info={})
  299. invoice_id = 1234567, db_alias = 'brand_test_alias', pay_status = 'started'
  300. action = 'checkOrder', xml_action = 'checkOrderResponse', sum_amount = 112
  301. payed_item = <Event: Мероприятие "Бизнес">
  302.  
  303.     def assertYandexNotificationResponseValid(self, response, invoice_id, db_alias, pay_status,
  304.                     action, xml_action, sum_amount, payed_item):
  305. >           self.assertEqual(200, response.code)
  306. E           AssertionError: 200 != 405
  307.  
  308. tests/test_payments_event.py:141: AssertionError
  309. ------------------------------- Captured stderr --------------------------------
  310. WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.26ms
  311. ________ TestYandexNotificationPayments.test_check_and_aviso_root_brand ________
  312.  
  313. self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_root_brand>
  314.  
  315.     def test_check_and_aviso_root_brand(self):
  316.             self.create_brand_connection(db_alias=DEFAULT_CONNECTION_NAME)
  317.             self.create_event_and_users(event_price=112)
  318. >           self._check_and_aviso(DEFAULT_CONNECTION_NAME)
  319.  
  320. tests/test_payments_event.py:278:
  321. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  322.  
  323. args = (<tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_root_brand>, 'default', <MagicMock name='NotifyMessage' id='69903760'>)
  324. keywargs = {}, extra_args = [<MagicMock name='NotifyMessage' id='69903760'>]
  325. entered_patchers = [<mock._patch object at 0x2f98610>]
  326. exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x4a96248>)
  327. patching = <mock._patch object at 0x2f98610>
  328. arg = <MagicMock name='NotifyMessage' id='69903760'>
  329.  
  330.     @wraps(func)
  331.     def patched(*args, **keywargs):
  332.         # don't use a with here (backwards compatability with Python 2.4)
  333.         extra_args = []
  334.         entered_patchers = []
  335.    
  336.         # can't use try...except...finally because of Python 2.4
  337.         # compatibility
  338.         exc_info = tuple()
  339.         try:
  340.             try:
  341.                 for patching in patched.patchings:
  342.                     arg = patching.__enter__()
  343.                     entered_patchers.append(patching)
  344.                     if patching.attribute_name is not None:
  345.                         keywargs.update(arg)
  346.                     elif patching.new is DEFAULT:
  347.                         extra_args.append(arg)
  348.    
  349.                 args += tuple(extra_args)
  350. >               return func(*args, **keywargs)
  351.  
  352. .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
  353. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  354.  
  355. self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_root_brand>
  356. db_alias = 'default'
  357. MockedNotifyMessage = <MagicMock name='NotifyMessage' id='69903760'>
  358.  
  359.     @patch('praktikum.libs.notify.notify.NotifyMessage')
  360.     def _check_and_aviso(self, db_alias, MockedNotifyMessage):
  361.             with switch_db(User, db_alias):
  362.                     user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
  363.                             password='qwerty').save()
  364.             invoice_id = 1234567
  365.             sum_amount = self.event1.price
  366.             md5 = '787614F67D2C14C507F1D9BC9D4C14AC'
  367.             data = self.get_yandex_check_data(self.event1, invoice_id, user.id,
  368.                     sum_amount, sum_amount, db_alias, md5)
  369.             # check
  370.             post_data = urlencode(data)
  371.             response = self.fetch(
  372.                     self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
  373.             t = self.assertYandexNotificationResponseValid(response, invoice_id, db_alias,
  374.                     T.PAY_STATUS.started, "checkOrder", "checkOrderResponse",
  375. >                   sum_amount, self.event1)
  376.  
  377. tests/test_payments_event.py:318:
  378. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  379.  
  380. self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_and_aviso_root_brand>
  381. response = HTTPResponse(_body=None,buffer=<_io.BytesIO object at 0x2f2f530>,code=405,effe...TTPRequest object at 0x42a9b10>,request_time=0.004920005798339844,time_info={})
  382. invoice_id = 1234567, db_alias = 'default', pay_status = 'started'
  383. action = 'checkOrder', xml_action = 'checkOrderResponse', sum_amount = 112
  384. payed_item = <Event: Мероприятие "Бизнес">
  385.  
  386.     def assertYandexNotificationResponseValid(self, response, invoice_id, db_alias, pay_status,
  387.                     action, xml_action, sum_amount, payed_item):
  388. >           self.assertEqual(200, response.code)
  389. E           AssertionError: 200 != 405
  390.  
  391. tests/test_payments_event.py:141: AssertionError
  392. ------------------------------- Captured stderr --------------------------------
  393. WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 3.08ms
  394. ________________ TestYandexNotificationPayments.test_check_fail ________________
  395.  
  396. self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_fail>
  397.  
  398.     def test_check_fail(self):
  399.             self.create_brand_connection(db_alias='brand_test_alias')
  400.             self.create_event_and_users(event_price=112)
  401.             md5 = '787614F67D2C14C507F1D9BC9D4C14AC'
  402.             bad_purchased_id = '53a191da9622a456a71d6e1d'
  403. >           self._check_fail(self._brands[0].db_alias, md5, purchased_id=bad_purchased_id)
  404.  
  405. tests/test_payments_event.py:285:
  406. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  407.  
  408. args = (<tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_fail>, 'brand_test_alias', '787614F67D2C14C507F1D9BC9D4C14AC', <MagicMock name='NotifyMessage' id='60168144'>)
  409. keywargs = {'purchased_id': '53a191da9622a456a71d6e1d'}
  410. extra_args = [<MagicMock name='NotifyMessage' id='60168144'>]
  411. entered_patchers = [<mock._patch object at 0x2f98710>]
  412. exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x36a4488>)
  413. patching = <mock._patch object at 0x2f98710>
  414. arg = <MagicMock name='NotifyMessage' id='60168144'>
  415.  
  416.     @wraps(func)
  417.     def patched(*args, **keywargs):
  418.         # don't use a with here (backwards compatability with Python 2.4)
  419.         extra_args = []
  420.         entered_patchers = []
  421.    
  422.         # can't use try...except...finally because of Python 2.4
  423.         # compatibility
  424.         exc_info = tuple()
  425.         try:
  426.             try:
  427.                 for patching in patched.patchings:
  428.                     arg = patching.__enter__()
  429.                     entered_patchers.append(patching)
  430.                     if patching.attribute_name is not None:
  431.                         keywargs.update(arg)
  432.                     elif patching.new is DEFAULT:
  433.                         extra_args.append(arg)
  434.    
  435.                 args += tuple(extra_args)
  436. >               return func(*args, **keywargs)
  437.  
  438. .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
  439. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  440.  
  441. self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_fail>
  442. db_alias = 'brand_test_alias', md5 = '787614F67D2C14C507F1D9BC9D4C14AC'
  443. MockedNotifyMessage = <MagicMock name='NotifyMessage' id='60168144'>
  444. kwargs = {'purchased_id': '53a191da9622a456a71d6e1d'}
  445. user = <User: test@email.com>, invoice_id = 1234567, sum_amount = 112
  446. data = {'action': 'checkOrder', 'brand_db_alias': 'brand_test_alias', 'customerNumber': '53a191da9622a456a71d6e1d', 'invoiceId': 1234567, ...}
  447. 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'
  448.  
  449.     @patch('praktikum.libs.notify.notify.NotifyMessage')
  450.     def _check_fail(self, db_alias, md5, MockedNotifyMessage, **kwargs):
  451.             user = kwargs.get('user')
  452.             if not user:
  453.                     user = User(id='53a191da9622a456a71d6e1d', email='test@email.com', password='qwerty').save()
  454.             invoice_id = 1234567
  455.             sum_amount = self.event1.price
  456.             data = self.get_yandex_check_data(self.event1, invoice_id, user.id,
  457.                     sum_amount, sum_amount, db_alias, md5, **kwargs)
  458.             # check
  459.             post_data = urlencode(data)
  460.             response = self.fetch(
  461.                     self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
  462. >           self.assertEqual(200, response.code)
  463. E           AssertionError: 200 != 405
  464.  
  465. tests/test_payments_event.py:370: AssertionError
  466. ------------------------------- Captured stderr --------------------------------
  467. WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.90ms
  468. __________ TestYandexNotificationPayments.test_check_fail_root_brand ___________
  469.  
  470. self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_fail_root_brand>
  471.  
  472.     def test_check_fail_root_brand(self):
  473.             self.create_brand_connection(db_alias=DEFAULT_CONNECTION_NAME)
  474.             self.create_event_and_users(event_price=112)
  475.             md5 = '787614F67D2C14C507F1D9BC9D4C14AC'
  476.             bad_purchased_id = '53a191da9622a456a71d6e1d'
  477. >           self._check_fail(DEFAULT_CONNECTION_NAME, md5, purchased_id=bad_purchased_id)
  478.  
  479. tests/test_payments_event.py:292:
  480. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  481.  
  482. args = (<tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_fail_root_brand>, 'default', '787614F67D2C14C507F1D9BC9D4C14AC', <MagicMock name='NotifyMessage' id='69934992'>)
  483. keywargs = {'purchased_id': '53a191da9622a456a71d6e1d'}
  484. extra_args = [<MagicMock name='NotifyMessage' id='69934992'>]
  485. entered_patchers = [<mock._patch object at 0x2f98710>]
  486. exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x47907e8>)
  487. patching = <mock._patch object at 0x2f98710>
  488. arg = <MagicMock name='NotifyMessage' id='69934992'>
  489.  
  490.     @wraps(func)
  491.     def patched(*args, **keywargs):
  492.         # don't use a with here (backwards compatability with Python 2.4)
  493.         extra_args = []
  494.         entered_patchers = []
  495.    
  496.         # can't use try...except...finally because of Python 2.4
  497.         # compatibility
  498.         exc_info = tuple()
  499.         try:
  500.             try:
  501.                 for patching in patched.patchings:
  502.                     arg = patching.__enter__()
  503.                     entered_patchers.append(patching)
  504.                     if patching.attribute_name is not None:
  505.                         keywargs.update(arg)
  506.                     elif patching.new is DEFAULT:
  507.                         extra_args.append(arg)
  508.    
  509.                 args += tuple(extra_args)
  510. >               return func(*args, **keywargs)
  511.  
  512. .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
  513. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  514.  
  515. self = <tests.test_payments_event.TestYandexNotificationPayments testMethod=test_check_fail_root_brand>
  516. db_alias = 'default', md5 = '787614F67D2C14C507F1D9BC9D4C14AC'
  517. MockedNotifyMessage = <MagicMock name='NotifyMessage' id='69934992'>
  518. kwargs = {'purchased_id': '53a191da9622a456a71d6e1d'}
  519. user = <User: test@email.com>, invoice_id = 1234567, sum_amount = 112
  520. data = {'action': 'checkOrder', 'brand_db_alias': 'default', 'customerNumber': '53a191da9622a456a71d6e1d', 'invoiceId': 1234567, ...}
  521. 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'
  522.  
  523.     @patch('praktikum.libs.notify.notify.NotifyMessage')
  524.     def _check_fail(self, db_alias, md5, MockedNotifyMessage, **kwargs):
  525.             user = kwargs.get('user')
  526.             if not user:
  527.                     user = User(id='53a191da9622a456a71d6e1d', email='test@email.com', password='qwerty').save()
  528.             invoice_id = 1234567
  529.             sum_amount = self.event1.price
  530.             data = self.get_yandex_check_data(self.event1, invoice_id, user.id,
  531.                     sum_amount, sum_amount, db_alias, md5, **kwargs)
  532.             # check
  533.             post_data = urlencode(data)
  534.             response = self.fetch(
  535.                     self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
  536. >           self.assertEqual(200, response.code)
  537. E           AssertionError: 200 != 405
  538.  
  539. tests/test_payments_event.py:370: AssertionError
  540. ------------------------------- Captured stderr --------------------------------
  541. WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.24ms
  542. ____ TestYandexNotificationPlan.test_plan_check_amount_unlimited_forbidden _____
  543.  
  544. self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_amount_unlimited_forbidden>
  545.  
  546.     def test_plan_check_amount_unlimited_forbidden(self):
  547.             db_alias = DEFAULT_CONNECTION_NAME
  548.             self.create_brand_connection(db_alias=db_alias)
  549.             plan = self.create_plan(u"Платный", is_default=False, price=208,
  550.                     is_unlimited=True)
  551.             user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
  552.                     password='qwerty', plan={'plan': plan.id})
  553.             user.save()
  554.             invoice_id = 2234567
  555.             amount = 5
  556.             sum_amount = plan.price*amount
  557.             md5_check = 'CD6FC329680877549B4DEC339E2E4818'
  558.             data = self.get_yandex_check_data(plan, invoice_id, user.id,
  559.                     sum_amount, sum_amount, db_alias, md5_check, amount=5)
  560.             # check
  561.             post_data = urlencode(data)
  562.             response = self.fetch(
  563.                     self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
  564. >           self.assertTrue('code="100"' in response.body)
  565. E           AssertionError: False is not true
  566.  
  567. tests/test_payments_plan.py:566: AssertionError
  568. ------------------------------- Captured stderr --------------------------------
  569. WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.43ms
  570. _____________ TestYandexNotificationPlan.test_plan_check_and_aviso _____________
  571.  
  572. self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso>
  573.  
  574.     def test_plan_check_and_aviso(self):
  575.             sum_amount = 208
  576.             plan_data = dict(title=u"Платный", is_default=False, price=sum_amount,
  577.                     max_conferences=10, max_users_per_conference=500)
  578.             md5_check = '27518523EC25145A66B0305353941F5E'
  579.             md5_aviso = '88B57D8BC680A73D8580FDDE64B79AA0'
  580. >           self._plan_check_and_aviso(plan_data, sum_amount, md5_check, md5_aviso, amount=1)
  581.  
  582. tests/test_payments_plan.py:458:
  583. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  584.  
  585. args = (<tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso>, {'is_default': False, 'ma..._per_conference': 500, 'price': 208, ...}, 208, '27518523EC25145A66B0305353941F5E', '88B57D8BC680A73D8580FDDE64B79AA0')
  586. kw = {'amount': 1}
  587.  
  588.     @wraps(f)
  589.     def _inner(*args, **kw):
  590.         self._patch_dict()
  591.         try:
  592. >           return f(*args, **kw)
  593.  
  594. .pyenv/local/lib/python2.7/site-packages/mock.py:1618:
  595. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  596.  
  597. args = (<tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso>, {'is_default': False, 'ma...8523EC25145A66B0305353941F5E', '88B57D8BC680A73D8580FDDE64B79AA0', <MagicMock name='NotifyMessage' id='75086032'>, ...)
  598. keywargs = {'amount': 1}
  599. extra_args = [<MagicMock name='NotifyMessage' id='75086032'>, <MagicMock name='imind' id='75159952'>]
  600. entered_patchers = [<mock._patch object at 0x2f90fd0>, <mock._patch object at 0x2f90f50>]
  601. exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x44a0ea8>)
  602. patching = <mock._patch object at 0x2f90fd0>
  603. arg = <MagicMock name='imind' id='75159952'>
  604.  
  605.     @wraps(func)
  606.     def patched(*args, **keywargs):
  607.         # don't use a with here (backwards compatability with Python 2.4)
  608.         extra_args = []
  609.         entered_patchers = []
  610.    
  611.         # can't use try...except...finally because of Python 2.4
  612.         # compatibility
  613.         exc_info = tuple()
  614.         try:
  615.             try:
  616.                 for patching in patched.patchings:
  617.                     arg = patching.__enter__()
  618.                     entered_patchers.append(patching)
  619.                     if patching.attribute_name is not None:
  620.                         keywargs.update(arg)
  621.                     elif patching.new is DEFAULT:
  622.                         extra_args.append(arg)
  623.    
  624.                 args += tuple(extra_args)
  625. >               return func(*args, **keywargs)
  626.  
  627. .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
  628. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  629.  
  630. self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso>
  631. plan_data = {'is_default': False, 'max_conferences': 10, 'max_users_per_conference': 500, 'price': 208, ...}
  632. sum_amount = 208, md5_check = '27518523EC25145A66B0305353941F5E'
  633. md5_aviso = '88B57D8BC680A73D8580FDDE64B79AA0'
  634. MockedNotifyMessage = <MagicMock name='NotifyMessage' id='75086032'>
  635. m_imind = <MagicMock name='imind' id='75159952'>, amount = 1
  636. db_alias = 'default'
  637.  
  638.     @patch.dict(settings, {'debug': False})
  639.     @patch.object(iMindMixin, 'imind')
  640.     @patch('praktikum.libs.notify.notify.NotifyMessage')
  641.     def _plan_check_and_aviso(self, plan_data, sum_amount, md5_check, md5_aviso,
  642.                     MockedNotifyMessage, m_imind, amount=1, db_alias=DEFAULT_CONNECTION_NAME):
  643.             m_imind.domain_administration.add_user.side_effect = mocked_imind_add_user
  644.             m_imind.domain_administration.get_subscription.side_effect = mocked_imind_get_subscription
  645.             self.create_brand_connection(db_alias=db_alias)
  646.             plan = self.create_plan(**plan_data)
  647.             user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
  648.                     password='qwerty', plan={'plan': plan.id})
  649.             user.save()
  650.    
  651.             invoice_id = 2234567
  652.             data = self.get_yandex_check_data(plan, invoice_id, user.id,
  653.                     sum_amount, sum_amount, db_alias, md5_check, amount)
  654.             # check
  655.             post_data = urlencode(data)
  656.             response = self.fetch(
  657.                     self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
  658.             t = self.assertYandexNotificationResponseValid(response, invoice_id, db_alias,
  659.                     T.PAY_STATUS.started, "checkOrder", "checkOrderResponse",
  660. >                   sum_amount, plan)
  661.  
  662. tests/test_payments_plan.py:590:
  663. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  664.  
  665. self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso>
  666. response = HTTPResponse(_body=None,buffer=<_io.BytesIO object at 0x47a9c50>,code=405,effe...TPRequest object at 0x47b9910>,request_time=0.0039789676666259766,time_info={})
  667. invoice_id = 2234567, db_alias = 'default', pay_status = 'started'
  668. action = 'checkOrder', xml_action = 'checkOrderResponse', sum_amount = 208
  669. payed_item = <Plan: Тариф "Платный">
  670.  
  671.     def assertYandexNotificationResponseValid(self, response, invoice_id, db_alias, pay_status,
  672.                     action, xml_action, sum_amount, payed_item):
  673. >           self.assertEqual(200, response.code)
  674. E           AssertionError: 200 != 405
  675.  
  676. tests/test_payments_event.py:141: AssertionError
  677. ------------------------------- Captured stderr --------------------------------
  678. WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.13ms
  679. ________ TestYandexNotificationPlan.test_plan_check_and_aviso_duration _________
  680.  
  681. self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso_duration>
  682.  
  683.     def test_plan_check_and_aviso_duration(self):
  684.             price = 208
  685.             amount = 8
  686.             sum_amount = str(D(price*amount) * D('0.85'))
  687.             plan_data = dict(title=u"Платный", is_default=False, price=price,
  688.                     max_conferences=10, max_users_per_conference=500,
  689.                     discounts={"3": 10, "6": 15, "12": 30})
  690.             md5_check = 'C869A48CB4FB925180C0DE84347A200C'
  691.             md5_aviso = '40935F5A8D3387380401614FDD8CC041'
  692. >           self._plan_check_and_aviso(plan_data, sum_amount, md5_check, md5_aviso, amount=amount)
  693.  
  694. tests/test_payments_plan.py:469:
  695. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  696.  
  697. args = (<tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso_duration>, {'discounts': {'...ax_users_per_conference': 500, ...}, '1414.40', 'C869A48CB4FB925180C0DE84347A200C', '40935F5A8D3387380401614FDD8CC041')
  698. kw = {'amount': 8}
  699.  
  700.     @wraps(f)
  701.     def _inner(*args, **kw):
  702.         self._patch_dict()
  703.         try:
  704. >           return f(*args, **kw)
  705.  
  706. .pyenv/local/lib/python2.7/site-packages/mock.py:1618:
  707. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  708.  
  709. args = (<tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso_duration>, {'discounts': {'...A48CB4FB925180C0DE84347A200C', '40935F5A8D3387380401614FDD8CC041', <MagicMock name='NotifyMessage' id='75152976'>, ...)
  710. keywargs = {'amount': 8}
  711. extra_args = [<MagicMock name='NotifyMessage' id='75152976'>, <MagicMock name='imind' id='74965584'>]
  712. entered_patchers = [<mock._patch object at 0x2f90fd0>, <mock._patch object at 0x2f90f50>]
  713. exc_info = (<class '_pytest.assertion.reinterpret.AssertionError'>, AssertionError('200 != 405',), <traceback object at 0x4aa9bd8>)
  714. patching = <mock._patch object at 0x2f90fd0>
  715. arg = <MagicMock name='imind' id='74965584'>
  716.  
  717.     @wraps(func)
  718.     def patched(*args, **keywargs):
  719.         # don't use a with here (backwards compatability with Python 2.4)
  720.         extra_args = []
  721.         entered_patchers = []
  722.    
  723.         # can't use try...except...finally because of Python 2.4
  724.         # compatibility
  725.         exc_info = tuple()
  726.         try:
  727.             try:
  728.                 for patching in patched.patchings:
  729.                     arg = patching.__enter__()
  730.                     entered_patchers.append(patching)
  731.                     if patching.attribute_name is not None:
  732.                         keywargs.update(arg)
  733.                     elif patching.new is DEFAULT:
  734.                         extra_args.append(arg)
  735.    
  736.                 args += tuple(extra_args)
  737. >               return func(*args, **keywargs)
  738.  
  739. .pyenv/local/lib/python2.7/site-packages/mock.py:1201:
  740. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  741.  
  742. self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso_duration>
  743. plan_data = {'discounts': {'12': 30, '3': 10, '6': 15}, 'is_default': False, 'max_conferences': 10, 'max_users_per_conference': 500, ...}
  744. sum_amount = '1414.40', md5_check = 'C869A48CB4FB925180C0DE84347A200C'
  745. md5_aviso = '40935F5A8D3387380401614FDD8CC041'
  746. MockedNotifyMessage = <MagicMock name='NotifyMessage' id='75152976'>
  747. m_imind = <MagicMock name='imind' id='74965584'>, amount = 8
  748. db_alias = 'default'
  749.  
  750.     @patch.dict(settings, {'debug': False})
  751.     @patch.object(iMindMixin, 'imind')
  752.     @patch('praktikum.libs.notify.notify.NotifyMessage')
  753.     def _plan_check_and_aviso(self, plan_data, sum_amount, md5_check, md5_aviso,
  754.                     MockedNotifyMessage, m_imind, amount=1, db_alias=DEFAULT_CONNECTION_NAME):
  755.             m_imind.domain_administration.add_user.side_effect = mocked_imind_add_user
  756.             m_imind.domain_administration.get_subscription.side_effect = mocked_imind_get_subscription
  757.             self.create_brand_connection(db_alias=db_alias)
  758.             plan = self.create_plan(**plan_data)
  759.             user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
  760.                     password='qwerty', plan={'plan': plan.id})
  761.             user.save()
  762.    
  763.             invoice_id = 2234567
  764.             data = self.get_yandex_check_data(plan, invoice_id, user.id,
  765.                     sum_amount, sum_amount, db_alias, md5_check, amount)
  766.             # check
  767.             post_data = urlencode(data)
  768.             response = self.fetch(
  769.                     self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
  770.             t = self.assertYandexNotificationResponseValid(response, invoice_id, db_alias,
  771.                     T.PAY_STATUS.started, "checkOrder", "checkOrderResponse",
  772. >                   sum_amount, plan)
  773.  
  774. tests/test_payments_plan.py:590:
  775. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
  776.  
  777. self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso_duration>
  778. response = HTTPResponse(_body=None,buffer=<_io.BytesIO object at 0x47a9f50>,code=405,effe...TTPRequest object at 0x4786f50>,request_time=0.004055023193359375,time_info={})
  779. invoice_id = 2234567, db_alias = 'default', pay_status = 'started'
  780. action = 'checkOrder', xml_action = 'checkOrderResponse', sum_amount = '1414.40'
  781. payed_item = <Plan: Тариф "Платный">
  782.  
  783.     def assertYandexNotificationResponseValid(self, response, invoice_id, db_alias, pay_status,
  784.                     action, xml_action, sum_amount, payed_item):
  785. >           self.assertEqual(200, response.code)
  786. E           AssertionError: 200 != 405
  787.  
  788. tests/test_payments_event.py:141: AssertionError
  789. ------------------------------- Captured stderr --------------------------------
  790. WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.16ms
  791.  TestYandexNotificationPlan.test_plan_check_and_aviso_duration_bad_price_forbidden
  792.  
  793. self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_and_aviso_duration_bad_price_forbidden>
  794.  
  795.     def test_plan_check_and_aviso_duration_bad_price_forbidden(self):
  796.             db_alias = DEFAULT_CONNECTION_NAME
  797.             self.create_brand_connection(db_alias=db_alias)
  798.             plan = self.create_plan(u"Платный", is_default=False, price=208,
  799.                     discounts={"3": 10, "6": 15, "12": 30})
  800.             user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
  801.                     password='qwerty', plan={'plan': plan.id})
  802.             user.save()
  803.    
  804.             invoice_id = 2234567
  805.             amount = 8
  806.             sum_amount = plan.price * amount
  807.             md5_check = '2EA6E898E8081204A30399E733DAC9D6'
  808.             data = self.get_yandex_check_data(plan, invoice_id, user.id,
  809.                     sum_amount, sum_amount, db_alias, md5_check, amount)
  810.             # check
  811.             post_data = urlencode(data)
  812.             response = self.fetch(
  813.                     self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
  814. >           self.assertTrue('code="100"' in response.body)
  815. E           AssertionError: False is not true
  816.  
  817. tests/test_payments_plan.py:526: AssertionError
  818. ------------------------------- Captured stderr --------------------------------
  819. WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.64ms
  820. ______ TestYandexNotificationPlan.test_plan_check_another_payed_forbidden ______
  821.  
  822. self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_another_payed_forbidden>
  823.  
  824.     def test_plan_check_another_payed_forbidden(self):
  825.             self.create_brand_connection(db_alias=DEFAULT_CONNECTION_NAME)
  826.             payed_plan1 = self.create_plan(is_default=False, price=100)
  827.             payed_plan2 = self.create_plan(is_default=False, price=200)
  828.             user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
  829.                     password='qwerty', plan={'plan': payed_plan1.id})
  830.             user.save()
  831.             sum_amount = payed_plan2.price
  832.             amount = 1
  833.             data = self.get_yandex_check_data(payed_plan2, 2234567, user.id,
  834.                     sum_amount, sum_amount, DEFAULT_CONNECTION_NAME,
  835.                     'B5FC591F028FBB6C33CAFFF3D5E309F1', amount)
  836.             post_data = urlencode(data)
  837.             response = self.fetch(
  838.                     self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
  839. >           self.assertTrue('code="100"' in response.body)
  840. E           AssertionError: False is not true
  841.  
  842. tests/test_payments_plan.py:505: AssertionError
  843. ------------------------------- Captured stderr --------------------------------
  844. WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.13ms
  845. __________ TestYandexNotificationPlan.test_plan_check_free_forbidden ___________
  846.  
  847. self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_free_forbidden>
  848.  
  849.     def test_plan_check_free_forbidden(self):
  850.             self.create_brand_connection(db_alias=DEFAULT_CONNECTION_NAME)
  851.             default_plan = self.create_plan(u"Базовый")
  852.             free_plan = self.create_plan(u"Беспалтный", is_default=False)
  853.             user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
  854.                     password='qwerty', plan={'plan': default_plan.id})
  855.             user.save()
  856.    
  857.             sum_amount = free_plan.price
  858.             amount = 1
  859.             data = self.get_yandex_check_data(free_plan, 2234567, user.id,
  860.                     sum_amount, sum_amount, DEFAULT_CONNECTION_NAME,
  861.                     'C486E8CF2A360022E33D9F228A4F9B67', amount)
  862.             # check denies free plan
  863.             post_data = urlencode(data)
  864.             response = self.fetch(
  865.                     self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
  866. >           self.assertTrue('code="100"' in response.body)
  867. E           AssertionError: False is not true
  868.  
  869. tests/test_payments_plan.py:488: AssertionError
  870. ------------------------------- Captured stderr --------------------------------
  871. WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.16ms
  872. _____ TestYandexNotificationPlan.test_plan_check_payed_unlimited_forbidden _____
  873.  
  874. self = <tests.test_payments_plan.TestYandexNotificationPlan testMethod=test_plan_check_payed_unlimited_forbidden>
  875.  
  876.     def test_plan_check_payed_unlimited_forbidden(self):
  877.             db_alias = DEFAULT_CONNECTION_NAME
  878.             self.create_brand_connection(db_alias=db_alias)
  879.             plan = self.create_plan(u"Платный", is_default=False, price=208,
  880.                     is_unlimited=True)
  881.             user = User(id='53a191da9622a456a71d6e1d', email='test@email.com',
  882.                     password='qwerty', plan={'plan': plan.id, 'is_payed': True})
  883.             user.save()
  884.    
  885.             invoice_id = 2234567
  886.             sum_amount = plan.price
  887.             md5_check = '27518523EC25145A66B0305353941F5E'
  888.             data = self.get_yandex_check_data(plan, invoice_id, user.id,
  889.                     sum_amount, sum_amount, db_alias, md5_check, amount=1)
  890.             # check
  891.             post_data = urlencode(data)
  892.             response = self.fetch(
  893.                     self.get_url('/api/payments/yandex/chek'), method="POST", body=post_data)
  894. >           self.assertTrue('code="100"' in response.body)
  895. E           AssertionError: False is not true
  896.  
  897. tests/test_payments_plan.py:546: AssertionError
  898. ------------------------------- Captured stderr --------------------------------
  899. WARNING:tornado.access:405 POST /api/payments/yandex/chek (127.0.0.1) 2.18ms
  900.  generated xml file: /var/lib/jenkins/jobs/praktikum_production/workspace/junit.xml
  901. =================== 14 failed, 128 passed in 401.26 seconds ====================
  902. Build step 'Execute shell' marked build as failure
  903. Recording test results
  904. Finished: FAILURE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement