Advertisement
Guest User

Untitled

a guest
Mar 14th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.87 KB | None | 0 0
  1. tests/test_apigee.py ... [ 2%]
  2. tests/test_chatbot.py ...F...F. [ 11%]
  3. tests/test_oauth.py .....F...F.FF [ 24%]
  4. tests/test_oauth_utils.py ................. [ 41%]
  5. tests/test_user.py ................................................... [ 92%]
  6. tests/test_utils.py . [ 93%]
  7. tests/test_vaporizer.py ....... [100%]
  8.  
  9. =================================== FAILURES ===================================
  10. ________________ ChatbootGoogleCallbackTestCase.test_valid_code ________________
  11.  
  12. self = <tests.test_chatbot.ChatbootGoogleCallbackTestCase testMethod=test_valid_code>
  13. mock_authorized_response = <MagicMock name='authorized_response' id='140269010711888'>
  14. mock_get = <MagicMock name='get' id='140269010713736'>
  15.  
  16. @patch("auth.oauth.providers.google.get")
  17. @patch("auth.oauth.providers.google.authorized_response")
  18. def test_valid_code(self, mock_authorized_response, mock_get):
  19. # token returned from google api
  20. mock_authorized_response.return_value = {
  21. "expires_in": 3600,
  22. "id_token": ("eyJhbGciOiJSUzI1NiIsImtpZCI6IjRiMTRiZWFkODZmZjBhZDRlZTAxZWFkYWUwNzBk" "YjM3YWE2YzY2Y2QifQ."),
  23. "token_type": "Bearer",
  24. "access_token": ("ya29.Ci9IA92ZqnIAgf3BUqMPkIW8X4NDB9JCu12ZsV5h902nGig5xj5Ix8WVzjy1ht3s2Q"),
  25. }
  26.  
  27. # user info returner from google api
  28. class UserInfo(object):
  29. data = {
  30. "locale": "en",
  31. "family_name": "Koci",
  32. "given_name": "Pavel",
  33. "name": "Pavel Koci",
  34. "id": "10974864908507278145",
  35. "email": "pavel.koci@vacuumapps.com",
  36. "verified_email": True,
  37. "picture": "https://lh3.googleusercontent.com/-rscbv5M/photo.jpg",
  38. "hd": "vacuumapps.com",
  39. }
  40.  
  41. mock_get.return_value = UserInfo()
  42.  
  43. url = "/v1/chatbot.google.authorized?state={}&" "code=4%2FVq84MGCyFcHuS-1tj7gpm9hbd81NhhW6eAfMN6TSb2o".format(
  44. "YXBwX2lkOjpodHRwOi8vd3d3Lmtpd2kuY29tOjpodHRwczovL2dyYXBoLmZhY2Vib29rLmNvbTo6bGlua190b2tlbg%3D%3D"
  45. )
  46.  
  47. response = self.client.get(url)
  48.  
  49. > self.assertEqual(response.status_code, 302)
  50. E AssertionError: 500 != 302
  51.  
  52. tests/test_chatbot.py:101: AssertionError
  53. ----------------------------- Captured stdout call -----------------------------
  54. 2019-03-14T17:03:43.725659Z [info ] request client_addr=127.0.0.1 forwarding= method=GET path=/v1/chatbot.google.authorized request_id=ab8e4e778100464e93d0383413eb1530
  55. 2019-03-14T17:03:43.748154Z [info ] oauth.redirect_url is_invalid=False request_id=ab8e4e778100464e93d0383413eb1530 url=http://www.kiwi.com
  56. 2019-03-14T17:03:43.749473Z [info ] parse_google_data.start data={"email": "pavel.koci@vacuumapps.com", "family_name": "Koci", "given_name": "Pavel", "hd": "vacuumapps.com", "id": "10974864908507278145", "locale": "en", "name": "Pavel Koci", "picture": "https://lh3.googleusercontent.com/-rscbv5M/photo.jpg", "verified_email": true} request_id=ab8e4e778100464e93d0383413eb1530
  57. 2019-03-14T17:03:43.750182Z [info ] parse_google_data.finish data={"email": "pavel.koci@vacuumapps.com", "email_verified": true, "first_name": "Pavel", "last_name": "Koci"} request_id=ab8e4e778100464e93d0383413eb1530
  58. 2019-03-14T17:03:43.859638Z [info ] response length=56 request_id=ab8e4e778100464e93d0383413eb1530 status=500
  59. ----------------------------- Captured stderr call -----------------------------
  60. 2019-03-14T17:03:42.415337Z [info ] stdlib_log [flask.app] message=initializing trace middleware request_id=71c27243d8ff4a6db1463626d79202f8
  61. 2019-03-14T17:03:42.426225Z [debug ] stdlib_log [ddtrace.encoding] message=using Msgpack encoder request_id=71c27243d8ff4a6db1463626d79202f8
  62. 2019-03-14T17:03:42.426732Z [info ] stdlib_log [ddtrace.sampler] message=initialized RateSampler, sample 100.0% of traces request_id=71c27243d8ff4a6db1463626d79202f8
  63. 2019-03-14T17:03:42.434032Z [debug ] stdlib_log [ddtrace.writer] message=resetting queues. pids(old:None new:68) request_id=71c27243d8ff4a6db1463626d79202f8
  64. 2019-03-14T17:03:42.434477Z [debug ] stdlib_log [ddtrace.writer] message=starting flush thread request_id=71c27243d8ff4a6db1463626d79202f8
  65. 2019-03-14T17:03:42.927535Z [error ] stdlib_log [ddtrace.writer] message=cannot send spans to localhost:8126: [Errno 99] Address not available
  66. 2019-03-14T17:03:42.932513Z [error ] stdlib_log [ddtrace.writer] message=cannot send services to localhost:8126: [Errno 99] Address not available
  67. 2019-03-14T17:03:43.442194Z [error ] stdlib_log [ddtrace.writer] message=cannot send spans to localhost:8126: [Errno 99] Address not available
  68. 2019-03-14T17:03:43.448537Z [error ] stdlib_log [ddtrace.writer] message=cannot send services to localhost:8126: [Errno 99] Address not available
  69. ------------------------------ Captured log call -------------------------------
  70. middleware.py 31 INFO initializing trace middleware
  71. encoding.py 77 DEBUG using Msgpack encoder
  72. sampler.py 41 INFO initialized RateSampler, sample 100.0% of traces
  73. _______________ ChatbotFacebookCallbackTestCase.test_valid_code ________________
  74.  
  75. self = <tests.test_chatbot.ChatbotFacebookCallbackTestCase testMethod=test_valid_code>
  76. mock_authorized_response = <MagicMock name='authorized_response' id='140269009375808'>
  77. mock_get = <MagicMock name='get' id='140269009727272'>
  78.  
  79. @patch("auth.oauth.providers.facebook.get")
  80. @patch("auth.oauth.providers.facebook.authorized_response")
  81. def test_valid_code(self, mock_authorized_response, mock_get):
  82. # token returned from google api
  83. mock_authorized_response.return_value = {
  84. "access_token": (
  85. "EAAOn6HZCqOwEBAN5W8ngQ7iZB7TyF9WvHT6GLjfeN7Bo8J92JZBG"
  86. "jFrFskU4UZApmP6EGhnbCZBJnBoI8kHcMR9tjoMATs4isbxcbgg2a"
  87. "3eu62vZBJyPDrsFKeCB6s4LA1aShnLjSazR8w3EkuST02QVP5tvbw"
  88. "CvAZD"
  89. ),
  90. "expires": "5102404",
  91. }
  92.  
  93. # user info returner from google api
  94. class UserInfo(object):
  95. data = {"last_name": "Pelikan", "email": "juraj.pelikan@gmail.com", "first_name": "Juraj"}
  96.  
  97. mock_get.return_value = UserInfo()
  98. url = (
  99. "/v1/chatbot.facebook.authorized?code=AQA_gYQhqs45SvcCexSvPN"
  100. "Lced0GQvPYf-lc0X0JCwdDlcgabynOsh78j-iJrS0canjF3q8dN4O81ir"
  101. "F5OLPagd8mAORKAu_qqcH57Ixz8Gl5BzAWkdLo0wh4cuBRSCtSCWNVCF2"
  102. "oUC2EDjWgjGsnDyzjBMDCkhn7hbJrbVEkGw4dtpyrAs8vv6a5m6XvJjgV"
  103. "WgnclfrDTh5s-iMNW3B0QOYpJL6ihpG0MpkemdeMWj3KafJWOGvZk65I9"
  104. "4Hfeh8vQw_teI2M-_J1HlqXZ0sE6ak_oLx-iiMp-dn2tpUYB5M6Zv-QGy"
  105. "eA1jKaD-4ht2H30&state={}"
  106. ).format("YXBwX2lkOjpodHRwOi8vd3d3Lmtpd2kuY29tOjpodHRwczovL2dyYXBoLmZhY2Vib29rLmNvbTo6bGlua190b2tlbg%3D%3D")
  107. response = self.client.get(url)
  108.  
  109. > self.assertEqual(response.status_code, 302)
  110. E AssertionError: 500 != 302
  111.  
  112. tests/test_chatbot.py:217: AssertionError
  113. ----------------------------- Captured stdout call -----------------------------
  114. 2019-03-14T17:03:52.114946Z [info ] request client_addr=127.0.0.1 forwarding= method=GET path=/v1/chatbot.facebook.authorized request_id=7826ffb809d444089221c42893f91b36
  115. 2019-03-14T17:03:52.120821Z [info ] oauth.redirect_url is_invalid=False request_id=7826ffb809d444089221c42893f91b36 url=http://www.kiwi.com
  116. 2019-03-14T17:03:52.121700Z [info ] parse_facebook_data.start data={"email": "juraj.pelikan@gmail.com", "first_name": "Juraj", "last_name": "Pelikan"} request_id=7826ffb809d444089221c42893f91b36
  117. 2019-03-14T17:03:52.122134Z [info ] parse_facebook_data.finish data={"email": "juraj.pelikan@gmail.com", "email_verified": true, "first_name": "Juraj", "last_name": "Pelikan"} request_id=7826ffb809d444089221c42893f91b36
  118. 2019-03-14T17:03:52.206025Z [info ] response length=56 request_id=7826ffb809d444089221c42893f91b36 status=500
  119. ----------------------------- Captured stderr call -----------------------------
  120. 2019-03-14T17:03:50.773631Z [info ] stdlib_log [flask.app] message=initializing trace middleware request_id=beed0f9345b247008c2848673d0eca52
  121. 2019-03-14T17:03:50.781036Z [debug ] stdlib_log [ddtrace.encoding] message=using Msgpack encoder request_id=beed0f9345b247008c2848673d0eca52
  122. 2019-03-14T17:03:50.781601Z [info ] stdlib_log [ddtrace.sampler] message=initialized RateSampler, sample 100.0% of traces request_id=beed0f9345b247008c2848673d0eca52
  123. 2019-03-14T17:03:50.788822Z [error ] stdlib_log [ddtrace.writer] message=cannot send spans to localhost:8126: [Errno 99] Address not available
  124. 2019-03-14T17:03:50.790798Z [debug ] stdlib_log [ddtrace.writer] message=resetting queues. pids(old:None new:68) request_id=beed0f9345b247008c2848673d0eca52
  125. 2019-03-14T17:03:50.791232Z [debug ] stdlib_log [ddtrace.writer] message=starting flush thread request_id=beed0f9345b247008c2848673d0eca52
  126. 2019-03-14T17:03:50.791903Z [error ] stdlib_log [ddtrace.writer] message=cannot send services to localhost:8126: [Errno 99] Address not available
  127. 2019-03-14T17:03:51.801344Z [error ] stdlib_log [ddtrace.writer] message=cannot send spans to localhost:8126: [Errno 99] Address not available
  128. 2019-03-14T17:03:51.807309Z [error ] stdlib_log [ddtrace.writer] message=cannot send services to localhost:8126: [Errno 99] Address not available
  129. ------------------------------ Captured log call -------------------------------
  130. middleware.py 31 INFO initializing trace middleware
  131. encoding.py 77 DEBUG using Msgpack encoder
  132. sampler.py 41 INFO initialized RateSampler, sample 100.0% of traces
  133. ____________________ GoogleCallbackTestCase.test_valid_code ____________________
  134.  
  135. self = <tests.test_oauth.GoogleCallbackTestCase testMethod=test_valid_code>
  136. mock_authorized_response = <MagicMock name='authorized_response' id='140269008716744'>
  137. mock_get = <MagicMock name='get' id='140269009084880'>
  138.  
  139. @patch("auth.oauth.providers.google.get")
  140. @patch("auth.oauth.providers.google.authorized_response")
  141. def test_valid_code(self, mock_authorized_response, mock_get):
  142. # token returned from google api
  143. mock_authorized_response.return_value = {
  144. "expires_in": 3600,
  145. "id_token": ("eyJhbGciOiJSUzI1NiIsImtpZCI6IjRiMTRiZWFkODZmZjBhZDRlZTAxZWFkYWUwNzBk" "YjM3YWE2YzY2Y2QifQ."),
  146. "token_type": "Bearer",
  147. "access_token": ("ya29.Ci9IA92ZqnIAgf3BUqMPkIW8X4NDB9JCu12ZsV5h902nGig5xj5Ix8WVzjy1ht3s2Q"),
  148. }
  149.  
  150. # user info returner from google api
  151. class UserInfo(object):
  152. data = {
  153. "locale": "en",
  154. "family_name": "Koci",
  155. "given_name": "Pavel",
  156. "name": "Pavel Koci",
  157. "id": "10974864908507278145",
  158. "email": "pavel.koci@vacuumapps.com",
  159. "verified_email": True,
  160. "picture": "https://lh3.googleusercontent.com/-rscbv5M/photo.jpg",
  161. "hd": "vacuumapps.com",
  162. }
  163.  
  164. mock_get.return_value = UserInfo()
  165.  
  166. url = "/v1/oauth.google.authorized?state={}&" "code=4%2FVq84MGCyFcHuS-1tj7gpm9hbd81NhhW6eAfMN6TSb2o".format(
  167. self.state
  168. )
  169.  
  170. response = self.client.get(url)
  171.  
  172. > self.assertEqual(response.status_code, 302)
  173. E AssertionError: 500 != 302
  174.  
  175. tests/test_oauth.py:106: AssertionError
  176. ----------------------------- Captured stdout call -----------------------------
  177. 2019-03-14T17:04:03.979448Z [info ] request client_addr=127.0.0.1 forwarding= method=GET path=/v1/oauth.google.authorized request_id=dda926280aae4773ae660449fb1f70b3
  178. 2019-03-14T17:04:03.985821Z [info ] oauth.redirect_url is_invalid=False request_id=dda926280aae4773ae660449fb1f70b3 url=http://localhost/next_uri
  179. 2019-03-14T17:04:03.986798Z [info ] parse_google_data.start data={"email": "pavel.koci@vacuumapps.com", "family_name": "Koci", "given_name": "Pavel", "hd": "vacuumapps.com", "id": "10974864908507278145", "locale": "en", "name": "Pavel Koci", "picture": "https://lh3.googleusercontent.com/-rscbv5M/photo.jpg", "verified_email": true} request_id=dda926280aae4773ae660449fb1f70b3
  180. 2019-03-14T17:04:03.987473Z [info ] parse_google_data.finish data={"email": "pavel.koci@vacuumapps.com", "email_verified": true, "first_name": "Pavel", "last_name": "Koci"} request_id=dda926280aae4773ae660449fb1f70b3
  181. 2019-03-14T17:04:04.080198Z [info ] response length=56 request_id=dda926280aae4773ae660449fb1f70b3 status=500
  182. ----------------------------- Captured stderr call -----------------------------
  183. 2019-03-14T17:04:02.530042Z [info ] stdlib_log [flask.app] message=initializing trace middleware request_id=5ab31580449a45ff8cf660f6202d946d
  184. 2019-03-14T17:04:02.545173Z [debug ] stdlib_log [ddtrace.encoding] message=using Msgpack encoder request_id=5ab31580449a45ff8cf660f6202d946d
  185. 2019-03-14T17:04:02.546549Z [info ] stdlib_log [ddtrace.sampler] message=initialized RateSampler, sample 100.0% of traces request_id=5ab31580449a45ff8cf660f6202d946d
  186. 2019-03-14T17:04:02.555752Z [debug ] stdlib_log [ddtrace.writer] message=resetting queues. pids(old:None new:68) request_id=5ab31580449a45ff8cf660f6202d946d
  187. 2019-03-14T17:04:02.556229Z [debug ] stdlib_log [ddtrace.writer] message=starting flush thread request_id=5ab31580449a45ff8cf660f6202d946d
  188. 2019-03-14T17:04:03.037516Z [error ] stdlib_log [ddtrace.writer] message=cannot send spans to localhost:8126: [Errno 99] Address not available
  189. 2019-03-14T17:04:03.042765Z [error ] stdlib_log [ddtrace.writer] message=cannot send services to localhost:8126: [Errno 99] Address not available
  190. 2019-03-14T17:04:03.560271Z [error ] stdlib_log [ddtrace.writer] message=cannot send spans to localhost:8126: [Errno 99] Address not available
  191. 2019-03-14T17:04:03.562922Z [error ] stdlib_log [ddtrace.writer] message=cannot send services to localhost:8126: [Errno 99] Address not available
  192. 2019-03-14T17:04:04.569119Z [error ] stdlib_log [ddtrace.writer] message=cannot send spans to localhost:8126: [Errno 99] Address not available
  193. 2019-03-14T17:04:04.573362Z [error ] stdlib_log [ddtrace.writer] message=cannot send services to localhost:8126: [Errno 99] Address not available
  194. ------------------------------ Captured log call -------------------------------
  195. middleware.py 31 INFO initializing trace middleware
  196. encoding.py 77 DEBUG using Msgpack encoder
  197. sampler.py 41 INFO initialized RateSampler, sample 100.0% of traces
  198. ___________________ FacebookCallbackTestCase.test_valid_code ___________________
  199.  
  200. self = <tests.test_oauth.FacebookCallbackTestCase testMethod=test_valid_code>
  201. mock_authorized_response = <MagicMock name='authorized_response' id='140269008198288'>
  202. mock_get = <MagicMock name='get' id='140269007705872'>
  203.  
  204. @patch("auth.oauth.providers.facebook.get")
  205. @patch("auth.oauth.providers.facebook.authorized_response")
  206. def test_valid_code(self, mock_authorized_response, mock_get):
  207. # token returned from google api
  208. mock_authorized_response.return_value = {
  209. "access_token": (
  210. "EAAOn6HZCqOwEBAN5W8ngQ7iZB7TyF9WvHT6GLjfeN7Bo8J92JZBG"
  211. "jFrFskU4UZApmP6EGhnbCZBJnBoI8kHcMR9tjoMATs4isbxcbgg2a"
  212. "3eu62vZBJyPDrsFKeCB6s4LA1aShnLjSazR8w3EkuST02QVP5tvbw"
  213. "CvAZD"
  214. ),
  215. "expires": "5102404",
  216. }
  217.  
  218. # user info returner from google api
  219. class UserInfo(object):
  220. data = {"last_name": "Pelikan", "email": "juraj.pelikan@gmail.com", "first_name": "Juraj"}
  221.  
  222. mock_get.return_value = UserInfo()
  223. url = (
  224. "/v1/oauth.facebook.authorized?code=AQA_gYQhqs45SvcCexSvPN"
  225. "Lced0GQvPYf-lc0X0JCwdDlcgabynOsh78j-iJrS0canjF3q8dN4O81ir"
  226. "F5OLPagd8mAORKAu_qqcH57Ixz8Gl5BzAWkdLo0wh4cuBRSCtSCWNVCF2"
  227. "oUC2EDjWgjGsnDyzjBMDCkhn7hbJrbVEkGw4dtpyrAs8vv6a5m6XvJjgV"
  228. "WgnclfrDTh5s-iMNW3B0QOYpJL6ihpG0MpkemdeMWj3KafJWOGvZk65I9"
  229. "4Hfeh8vQw_teI2M-_J1HlqXZ0sE6ak_oLx-iiMp-dn2tpUYB5M6Zv-QGy"
  230. "eA1jKaD-4ht2H30&state={}"
  231. ).format(self.state)
  232. response = self.client.get(url)
  233.  
  234. > self.assertEqual(response.status_code, 302)
  235. E AssertionError: 500 != 302
  236.  
  237. tests/test_oauth.py:204: AssertionError
  238. ----------------------------- Captured stdout call -----------------------------
  239. 2019-03-14T17:04:10.520890Z [info ] request client_addr=127.0.0.1 forwarding= method=GET path=/v1/oauth.facebook.authorized request_id=263004189d5b4a0cbb7dfb30964b8a19
  240. 2019-03-14T17:04:10.526580Z [info ] oauth.redirect_url is_invalid=False request_id=263004189d5b4a0cbb7dfb30964b8a19 url=http://localhost/next_uri
  241. 2019-03-14T17:04:10.527198Z [info ] parse_facebook_data.start data={"email": "juraj.pelikan@gmail.com", "first_name": "Juraj", "last_name": "Pelikan"} request_id=263004189d5b4a0cbb7dfb30964b8a19
  242. 2019-03-14T17:04:10.527624Z [info ] parse_facebook_data.finish data={"email": "juraj.pelikan@gmail.com", "email_verified": true, "first_name": "Juraj", "last_name": "Pelikan"} request_id=263004189d5b4a0cbb7dfb30964b8a19
  243. 2019-03-14T17:04:10.613207Z [info ] response length=56 request_id=263004189d5b4a0cbb7dfb30964b8a19 status=500
  244. ----------------------------- Captured stderr call -----------------------------
  245. 2019-03-14T17:04:09.193606Z [info ] stdlib_log [flask.app] message=initializing trace middleware request_id=decabbaa67cc47c5872fa29c1384b6b2
  246. 2019-03-14T17:04:09.201902Z [debug ] stdlib_log [ddtrace.encoding] message=using Msgpack encoder request_id=decabbaa67cc47c5872fa29c1384b6b2
  247. 2019-03-14T17:04:09.202386Z [info ] stdlib_log [ddtrace.sampler] message=initialized RateSampler, sample 100.0% of traces request_id=decabbaa67cc47c5872fa29c1384b6b2
  248. 2019-03-14T17:04:09.209675Z [debug ] stdlib_log [ddtrace.writer] message=resetting queues. pids(old:None new:68) request_id=decabbaa67cc47c5872fa29c1384b6b2
  249. 2019-03-14T17:04:09.210112Z [debug ] stdlib_log [ddtrace.writer] message=starting flush thread request_id=decabbaa67cc47c5872fa29c1384b6b2
  250. 2019-03-14T17:04:09.713634Z [error ] stdlib_log [ddtrace.writer] message=cannot send spans to localhost:8126: [Errno 99] Address not available
  251. 2019-03-14T17:04:09.717894Z [error ] stdlib_log [ddtrace.writer] message=cannot send services to localhost:8126: [Errno 99] Address not available
  252. 2019-03-14T17:04:10.215471Z [error ] stdlib_log [ddtrace.writer] message=cannot send spans to localhost:8126: [Errno 99] Address not available
  253. 2019-03-14T17:04:10.218956Z [error ] stdlib_log [ddtrace.writer] message=cannot send services to localhost:8126: [Errno 99] Address not available
  254. ------------------------------ Captured log call -------------------------------
  255. middleware.py 31 INFO initializing trace middleware
  256. encoding.py 77 DEBUG using Msgpack encoder
  257. sampler.py 41 INFO initialized RateSampler, sample 100.0% of traces
  258. ______________ FacebookMobileConnectTestCase.test_mobile_connect _______________
  259.  
  260. self = <tests.test_oauth.FacebookMobileConnectTestCase testMethod=test_mobile_connect>
  261. mock_get = <MagicMock name='get' id='140269007506624'>
  262. mock_verifier = <MagicMock name='verify_access_token' id='140269007520152'>
  263.  
  264. @patch("auth.oauth.views.verify_access_token")
  265. @patch("auth.oauth.providers.facebook.get")
  266. def test_mobile_connect(self, mock_get, mock_verifier):
  267. self.assertEqual(User.query.count(), 0)
  268.  
  269. class UserInfo(object):
  270. data = {"last_name": "Pelikan", "email": "juraj.pelikan@gmail.com", "first_name": "Juraj"}
  271.  
  272. mock_get.return_value = UserInfo()
  273. oauth_payload = {
  274. "access_token": (
  275. "EAAOn6HZCqOwEBAN5W8ngQ7iZB7TyF9WvHT6GLjfeN7Bo8J92JZBG"
  276. "jFrFskU4UZApmP6EGhnbCZBJnBoI8kHcMR9tjoMATs4isbxcbgg2a"
  277. "3eu62vZBJyPDrsFKeCB6s4LA1aShnLjSazR8w3EkuST02QVP5tvbw"
  278. "CvAZD"
  279. ),
  280. "expires": "5102404",
  281. }
  282. headers = {"Authorization": "Basic " + b64encode(b"app_id:").decode("utf8")}
  283. resp = self.client.post(
  284. "/v1/oauth.facebook.connect",
  285. data=json.dumps(oauth_payload),
  286. content_type="application/json",
  287. headers=headers,
  288. )
  289. > self.assertIn("token", json.loads(resp.data))
  290. E AssertionError: 'token' not found in {'error_code': 'SQL_FAILED', 'message': 'Database error.'}
  291.  
  292. tests/test_oauth.py:246: AssertionError
  293. ----------------------------- Captured stdout call -----------------------------
  294. 2019-03-14T17:04:14.669478Z [info ] request client_addr=127.0.0.1 forwarding= json={'access_token': 'EAAOn6HZCqOwEBAN5W8ngQ7iZB7TyF9WvHT6GLjfeN7Bo8J92JZBGjFrFskU4UZApmP6EGhnbCZBJnBoI8kHcMR9tjoMATs4isbxcbgg2a3eu62vZBJyPDrsFKeCB6s4LA1aShnLjSazR8w3EkuST02QVP5tvbwCvAZD', 'expires': '5102404'} method=POST path=/v1/oauth.facebook.connect request_id=233e9d0a7aaf41908ee47a3ef634c6ed
  295. 2019-03-14T17:04:14.679314Z [info ] parse_facebook_data.start data={"email": "juraj.pelikan@gmail.com", "first_name": "Juraj", "last_name": "Pelikan"} request_id=233e9d0a7aaf41908ee47a3ef634c6ed
  296. 2019-03-14T17:04:14.679680Z [info ] parse_facebook_data.finish data={"email": "juraj.pelikan@gmail.com", "email_verified": true, "first_name": "Juraj", "last_name": "Pelikan"} request_id=233e9d0a7aaf41908ee47a3ef634c6ed
  297. 2019-03-14T17:04:14.771341Z [info ] response length=56 request_id=233e9d0a7aaf41908ee47a3ef634c6ed status=500
  298. ----------------------------- Captured stderr call -----------------------------
  299. 2019-03-14T17:04:13.275735Z [info ] stdlib_log [flask.app] message=initializing trace middleware request_id=49753ee9620a487bbb989e481f998fb5
  300. 2019-03-14T17:04:13.287691Z [debug ] stdlib_log [ddtrace.encoding] message=using Msgpack encoder request_id=49753ee9620a487bbb989e481f998fb5
  301. 2019-03-14T17:04:13.288742Z [info ] stdlib_log [ddtrace.sampler] message=initialized RateSampler, sample 100.0% of traces request_id=49753ee9620a487bbb989e481f998fb5
  302. 2019-03-14T17:04:13.298281Z [error ] stdlib_log [ddtrace.writer] message=cannot send spans to localhost:8126: [Errno 99] Address not available
  303. 2019-03-14T17:04:13.300164Z [error ] stdlib_log [ddtrace.writer] message=cannot send services to localhost:8126: [Errno 99] Address not available
  304. 2019-03-14T17:04:13.300773Z [debug ] stdlib_log [ddtrace.writer] message=resetting queues. pids(old:None new:68) request_id=49753ee9620a487bbb989e481f998fb5
  305. 2019-03-14T17:04:13.301179Z [debug ] stdlib_log [ddtrace.writer] message=starting flush thread request_id=49753ee9620a487bbb989e481f998fb5
  306. 2019-03-14T17:04:14.306060Z [error ] stdlib_log [ddtrace.writer] message=cannot send spans to localhost:8126: [Errno 99] Address not available
  307. 2019-03-14T17:04:14.308691Z [error ] stdlib_log [ddtrace.writer] message=cannot send services to localhost:8126: [Errno 99] Address not available
  308. ------------------------------ Captured log call -------------------------------
  309. middleware.py 31 INFO initializing trace middleware
  310. encoding.py 77 DEBUG using Msgpack encoder
  311. sampler.py 41 INFO initialized RateSampler, sample 100.0% of traces
  312. ________________ GoogleMobileConectTestCase.test_mobile_connect ________________
  313.  
  314. self = <tests.test_oauth.GoogleMobileConectTestCase testMethod=test_mobile_connect>
  315. mock_get = <MagicMock name='get' id='140269007031992'>
  316. mock_verifier = <MagicMock name='verify_access_token' id='140269008206088'>
  317.  
  318. @patch("auth.oauth.views.verify_access_token")
  319. @patch("auth.oauth.providers.google.get")
  320. def test_mobile_connect(self, mock_get, mock_verifier):
  321. self.assertEqual(User.query.count(), 0)
  322.  
  323. class UserInfo(object):
  324. data = {
  325. "locale": "en",
  326. "family_name": "Koci",
  327. "given_name": "Pavel",
  328. "name": "Pavel Koci",
  329. "id": "10974864908507278145",
  330. "email": "pavel.koci@vacuumapps.com",
  331. "verified_email": True,
  332. "picture": "https://lh3.googleusercontent.com/-rscbv5M/photo.jpg",
  333. "hd": "vacuumapps.com",
  334. }
  335.  
  336. mock_get.return_value = UserInfo()
  337. oauth_payload = {
  338. "access_token": (
  339. "EAAOn6HZCqOwEBAN5W8ngQ7iZB7TyF9WvHT6GLjfeN7Bo8J92JZBG"
  340. "jFrFskU4UZApmP6EGhnbCZBJnBoI8kHcMR9tjoMATs4isbxcbgg2a"
  341. "3eu62vZBJyPDrsFKeCB6s4LA1aShnLjSazR8w3EkuST02QVP5tvbw"
  342. "CvAZD"
  343. ),
  344. "expires": "5102404",
  345. }
  346. headers = {"Authorization": "Basic " + b64encode(b"app_id:").decode("utf8")}
  347. resp = self.client.post(
  348. "/v1/oauth.google.connect", data=json.dumps(oauth_payload), content_type="application/json", headers=headers
  349. )
  350. > self.assertIn("token", json.loads(resp.data))
  351. E AssertionError: 'token' not found in {'error_code': 'SQL_FAILED', 'message': 'Database error.'}
  352.  
  353. tests/test_oauth.py:298: AssertionError
  354. ----------------------------- Captured stdout call -----------------------------
  355. 2019-03-14T17:04:17.075935Z [info ] request client_addr=127.0.0.1 forwarding= json={'access_token': 'EAAOn6HZCqOwEBAN5W8ngQ7iZB7TyF9WvHT6GLjfeN7Bo8J92JZBGjFrFskU4UZApmP6EGhnbCZBJnBoI8kHcMR9tjoMATs4isbxcbgg2a3eu62vZBJyPDrsFKeCB6s4LA1aShnLjSazR8w3EkuST02QVP5tvbwCvAZD', 'expires': '5102404'} method=POST path=/v1/oauth.google.connect request_id=9617537da6c3438fa47d1e1d2305a2a8
  356. 2019-03-14T17:04:17.080314Z [info ] parse_google_data.start data={"email": "pavel.koci@vacuumapps.com", "family_name": "Koci", "given_name": "Pavel", "hd": "vacuumapps.com", "id": "10974864908507278145", "locale": "en", "name": "Pavel Koci", "picture": "https://lh3.googleusercontent.com/-rscbv5M/photo.jpg", "verified_email": true} request_id=9617537da6c3438fa47d1e1d2305a2a8
  357. 2019-03-14T17:04:17.080663Z [info ] parse_google_data.finish data={"email": "pavel.koci@vacuumapps.com", "email_verified": true, "first_name": "Pavel", "last_name": "Koci"} request_id=9617537da6c3438fa47d1e1d2305a2a8
  358. 2019-03-14T17:04:17.151207Z [info ] response length=56 request_id=9617537da6c3438fa47d1e1d2305a2a8 status=500
  359. ----------------------------- Captured stderr call -----------------------------
  360. 2019-03-14T17:04:15.341516Z [info ] stdlib_log [flask.app] message=initializing trace middleware request_id=233e9d0a7aaf41908ee47a3ef634c6ed
  361. 2019-03-14T17:04:15.346497Z [debug ] stdlib_log [ddtrace.encoding] message=using Msgpack encoder request_id=233e9d0a7aaf41908ee47a3ef634c6ed
  362. 2019-03-14T17:04:15.346984Z [info ] stdlib_log [ddtrace.sampler] message=initialized RateSampler, sample 100.0% of traces request_id=233e9d0a7aaf41908ee47a3ef634c6ed
  363. 2019-03-14T17:04:15.353702Z [error ] stdlib_log [ddtrace.writer] message=cannot send spans to localhost:8126: [Errno 99] Address not available
  364. 2019-03-14T17:04:15.355667Z [debug ] stdlib_log [ddtrace.writer] message=resetting queues. pids(old:None new:68) request_id=233e9d0a7aaf41908ee47a3ef634c6ed
  365. 2019-03-14T17:04:15.356131Z [debug ] stdlib_log [ddtrace.writer] message=starting flush thread request_id=233e9d0a7aaf41908ee47a3ef634c6ed
  366. 2019-03-14T17:04:15.356762Z [error ] stdlib_log [ddtrace.writer] message=cannot send services to localhost:8126: [Errno 99] Address not available
  367. 2019-03-14T17:04:16.363432Z [error ] stdlib_log [ddtrace.writer] message=cannot send spans to localhost:8126: [Errno 99] Address not available
  368. 2019-03-14T17:04:16.368514Z [error ] stdlib_log [ddtrace.writer] message=cannot send services to localhost:8126: [Errno 99] Address not available
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement