Advertisement
Guest User

AttributeError: 'dict' object has no attribute 'data'

a guest
Jan 19th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 26.84 KB | None | 0 0
  1. 'app'>>
  2.  
  3.     @patch.object(
  4.         FizzbarService,
  5.         "get_all",
  6.         lambda: [
  7.             make_fizzbar(123, name="Test Fizzbar 1"),
  8.             make_fizzbar(456, name="Test Fizzbar 2"),
  9.         ],
  10.     )
  11.     def test_get(self, client: FlaskClient):  # noqa
  12.         with client:
  13.             results = client.get(
  14.                 f"/api/{BASE_ROUTE}/fizzbar", follow_redirects=True
  15.             ).get_json()
  16.             expected = (
  17.                 FizzbarSchema(many=True)
  18.                 .dump(
  19.                     [
  20.                         make_fizzbar(123, name="Test Fizzbar 1"),
  21. >                       make_fizzbar(456, name="Test Fizzbar 2"),
  22.                     ]
  23.                 )
  24.                 .data
  25.             )
  26. E           AttributeError: 'list' object has no attribute 'data'
  27.  
  28. app/fizz/fizzbar/controller_test.py:37: AttributeError
  29. ___________________________________________ TestFizzbarResource.test_post ____________________________________________
  30.  
  31. self = <app.fizz.fizzbar.controller_test.TestFizzbarResource object at 0x7fbcc97cf550>
  32. client = <FlaskClient <Flask 'app'>>
  33.  
  34.     @patch.object(
  35.         FizzbarService, "create", lambda create_request: Fizzbar(**create_request)
  36.     )
  37.     def test_post(self, client: FlaskClient):  # noqa
  38.         with client:
  39.    
  40.             payload = dict(name="Test fizzbar", purpose="Test purpose")
  41.             result = client.post(f"/api/{BASE_ROUTE}/fizzbar/", json=payload).get_json()
  42.             expected = (
  43.                 FizzbarSchema()
  44. >               .dump(Fizzbar(name=payload["name"], purpose=payload["purpose"]))
  45.                 .data
  46.             )
  47. E           AttributeError: 'dict' object has no attribute 'data'
  48.  
  49. app/fizz/fizzbar/controller_test.py:55: AttributeError
  50. ___________________________________________ TestFizzbarIdResource.test_put ___________________________________________
  51.  
  52. self = <app.fizz.fizzbar.controller_test.TestFizzbarIdResource object at 0x7fbcc977d650>
  53. client = <FlaskClient <Flask 'app'>>
  54.  
  55.     @patch.object(FizzbarService, "get_by_id", lambda id: make_fizzbar(id=id))
  56.     @patch.object(FizzbarService, "update", fake_update)
  57.     def test_put(self, client: FlaskClient):  # noqa
  58.         with client:
  59.             result = client.put(
  60.                 f"/api/{BASE_ROUTE}/fizzbar/123",
  61.                 json={"name": "New Fizzbar", "purpose": "New purpose"},
  62.             ).get_json()
  63.             expected = (
  64.                 FizzbarSchema()
  65.                 .dump(
  66. >                   Fizzbar(fizzbar_id=123, name="New Fizzbar", purpose="New purpose")
  67.                 )
  68.                 .data
  69.             )
  70. E           AttributeError: 'dict' object has no attribute 'data'
  71.  
  72. app/fizz/fizzbar/controller_test.py:95: AttributeError
  73. ______________________________________________ test_FizzbarSchema_works ______________________________________________
  74.  
  75. schema = <FizzbarSchema(many=False)>
  76.  
  77.     def test_FizzbarSchema_works(schema: FizzbarSchema):
  78.         params: FizzbarInterface = schema.load(
  79. >           {"fizzbarId": "123", "name": "Test fizzbar", "purpose": "Test purpose"}
  80.         ).data
  81. E       AttributeError: 'dict' object has no attribute 'data'
  82.  
  83. app/fizz/fizzbar/schema_test.py:19: AttributeError
  84. ____________________________________________ TestFizzbazResource.test_get ____________________________________________
  85.  
  86. self = <app.fizz.fizzbaz.controller_test.TestFizzbazResource object at 0x7fbcc9452a50>
  87. client = <FlaskClient <Flask 'app'>>
  88.  
  89.     @patch.object(
  90.         FizzbazService,
  91.         "get_all",
  92.         lambda: [
  93.             make_fizzbaz(123, name="Test Fizzbaz 1"),
  94.             make_fizzbaz(456, name="Test Fizzbaz 2"),
  95.         ],
  96.     )
  97.     def test_get(self, client: FlaskClient):  # noqa
  98.         with client:
  99.             results = client.get(
  100.                 f"/api/{BASE_ROUTE}/fizzbaz", follow_redirects=True
  101.             ).get_json()
  102.             expected = (
  103.                 FizzbazSchema(many=True)
  104.                 .dump(
  105.                     [
  106.                         make_fizzbaz(123, name="Test Fizzbaz 1"),
  107. >                       make_fizzbaz(456, name="Test Fizzbaz 2"),
  108.                     ]
  109.                 )
  110.                 .data
  111.             )
  112. E           AttributeError: 'list' object has no attribute 'data'
  113.  
  114. app/fizz/fizzbaz/controller_test.py:37: AttributeError
  115. ___________________________________________ TestFizzbazResource.test_post ____________________________________________
  116.  
  117. self = <app.fizz.fizzbaz.controller_test.TestFizzbazResource object at 0x7fbcc93ffc10>
  118. client = <FlaskClient <Flask 'app'>>
  119.  
  120.     @patch.object(
  121.         FizzbazService, "create", lambda create_request: Fizzbaz(**create_request)
  122.     )
  123.     def test_post(self, client: FlaskClient):  # noqa
  124.         with client:
  125.    
  126.             payload = dict(name="Test fizzbaz", purpose="Test purpose")
  127.             result = client.post(f"/api/{BASE_ROUTE}/fizzbaz/", json=payload).get_json()
  128.             expected = (
  129.                 FizzbazSchema()
  130. >               .dump(Fizzbaz(name=payload["name"], purpose=payload["purpose"]))
  131.                 .data
  132.             )
  133. E           AttributeError: 'dict' object has no attribute 'data'
  134.  
  135. app/fizz/fizzbaz/controller_test.py:55: AttributeError
  136. ___________________________________________ TestFizzbazIdResource.test_put ___________________________________________
  137.  
  138. self = <app.fizz.fizzbaz.controller_test.TestFizzbazIdResource object at 0x7fbcc938db10>
  139. client = <FlaskClient <Flask 'app'>>
  140.  
  141.     @patch.object(FizzbazService, "get_by_id", lambda id: make_fizzbaz(id=id))
  142.     @patch.object(FizzbazService, "update", fake_update)
  143.     def test_put(self, client: FlaskClient):  # noqa
  144.         with client:
  145.             result = client.put(
  146.                 f"/api/{BASE_ROUTE}/fizzbaz/123",
  147.                 json={"name": "New Fizzbaz", "purpose": "New purpose"},
  148.             ).get_json()
  149.             expected = (
  150.                 FizzbazSchema()
  151.                 .dump(
  152. >                   Fizzbaz(fizzbaz_id=123, name="New Fizzbaz", purpose="New purpose")
  153.                 )
  154.                 .data
  155.             )
  156. E           AttributeError: 'dict' object has no attribute 'data'
  157.  
  158. app/fizz/fizzbaz/controller_test.py:95: AttributeError
  159. ______________________________________________ test_FizzbazSchema_works ______________________________________________
  160.  
  161. schema = <FizzbazSchema(many=False)>
  162.  
  163.     def test_FizzbazSchema_works(schema: FizzbazSchema):
  164.         params: FizzbazInterface = schema.load(
  165. >           {"fizzbazId": "123", "name": "Test fizzbaz", "purpose": "Test purpose"}
  166.         ).data
  167. E       AttributeError: 'dict' object has no attribute 'data'
  168.  
  169. app/fizz/fizzbaz/schema_test.py:19: AttributeError
  170. ____________________________________________ TestDoodadResource.test_get _____________________________________________
  171.  
  172. self = <app.other_api.doodad.controller_test.TestDoodadResource object at 0x7fbcc927ccd0>
  173. client = <FlaskClient <Flask 'app'>>
  174.  
  175.     @patch.object(
  176.         DoodadService,
  177.         "get_all",
  178.         lambda: [
  179.             make_doodad(123, name="Test Doodad 1"),
  180.             make_doodad(456, name="Test Doodad 2"),
  181.         ],
  182.     )
  183.     def test_get(self, client: FlaskClient):  # noqa
  184.         with client:
  185.             results = client.get(
  186.                 f"/api/{BASE_ROUTE}/doodad", follow_redirects=True
  187.             ).get_json()
  188.             expected = (
  189.                 DoodadSchema(many=True)
  190.                 .dump(
  191.                     [
  192.                         make_doodad(123, name="Test Doodad 1"),
  193. >                       make_doodad(456, name="Test Doodad 2"),
  194.                     ]
  195.                 )
  196.                 .data
  197.             )
  198. E           AttributeError: 'list' object has no attribute 'data'
  199.  
  200. app/other_api/doodad/controller_test.py:37: AttributeError
  201. ____________________________________________ TestDoodadResource.test_post ____________________________________________
  202.  
  203. self = <app.other_api.doodad.controller_test.TestDoodadResource object at 0x7fbcc91ec290>
  204. client = <FlaskClient <Flask 'app'>>
  205.  
  206.     @patch.object(
  207.         DoodadService, "create", lambda create_request: Doodad(**create_request)
  208.     )
  209.     def test_post(self, client: FlaskClient):  # noqa
  210.         with client:
  211.    
  212.             payload = dict(name="Test doodad", purpose="Test purpose")
  213.             result = client.post(f"/api/{BASE_ROUTE}/doodad/", json=payload).get_json()
  214.             expected = (
  215.                 DoodadSchema()
  216. >               .dump(Doodad(name=payload["name"], purpose=payload["purpose"]))
  217.                 .data
  218.             )
  219. E           AttributeError: 'dict' object has no attribute 'data'
  220.  
  221. app/other_api/doodad/controller_test.py:55: AttributeError
  222. ___________________________________________ TestDoodadIdResource.test_put ____________________________________________
  223.  
  224. self = <app.other_api.doodad.controller_test.TestDoodadIdResource object at 0x7fbcc916b2d0>
  225. client = <FlaskClient <Flask 'app'>>
  226.  
  227.     @patch.object(DoodadService, "get_by_id", lambda id: make_doodad(id=id))
  228.     @patch.object(DoodadService, "update", fake_update)
  229.     def test_put(self, client: FlaskClient):  # noqa
  230.         with client:
  231.             result = client.put(
  232.                 f"/api/{BASE_ROUTE}/doodad/123",
  233.                 json={"name": "New Doodad", "purpose": "New purpose"},
  234.             ).get_json()
  235.             expected = (
  236.                 DoodadSchema()
  237. >               .dump(Doodad(doodad_id=123, name="New Doodad", purpose="New purpose"))
  238.                 .data
  239.             )
  240. E           AttributeError: 'dict' object has no attribute 'data'
  241.  
  242. app/other_api/doodad/controller_test.py:94: AttributeError
  243. ______________________________________________ test_DoodadSchema_works _______________________________________________
  244.  
  245. schema = <DoodadSchema(many=False)>
  246.  
  247.     def test_DoodadSchema_works(schema: DoodadSchema):
  248.         params: DoodadInterface = schema.load(
  249. >           {"doodadId": "123", "name": "Test doodad", "purpose": "Test purpose"}
  250.         ).data
  251. E       AttributeError: 'dict' object has no attribute 'data'
  252.  
  253. app/other_api/doodad/schema_test.py:19: AttributeError
  254. ____________________________________________ TestWhatsitResource.test_get ____________________________________________
  255.  
  256. self = <app.other_api.whatsit.controller_test.TestWhatsitResource object at 0x7fbcc906eb10>
  257. client = <FlaskClient <Flask 'app'>>
  258.  
  259.     @patch.object(
  260.         WhatsitService,
  261.         "get_all",
  262.         lambda: [
  263.             make_whatsit(123, name="Test Whatsit 1"),
  264.             make_whatsit(456, name="Test Whatsit 2"),
  265.         ],
  266.     )
  267.     def test_get(self, client: FlaskClient):  # noqa
  268.         with client:
  269.             results = client.get(
  270.                 f"/api/{BASE_ROUTE}/whatsit", follow_redirects=True
  271.             ).get_json()
  272.             expected = (
  273.                 WhatsitSchema(many=True)
  274.                 .dump(
  275.                     [
  276.                         make_whatsit(123, name="Test Whatsit 1"),
  277. >                       make_whatsit(456, name="Test Whatsit 2"),
  278.                     ]
  279.                 )
  280.                 .data
  281.             )
  282. E           AttributeError: 'list' object has no attribute 'data'
  283.  
  284. app/other_api/whatsit/controller_test.py:37: AttributeError
  285. ___________________________________________ TestWhatsitResource.test_post ____________________________________________
  286.  
  287. self = <app.other_api.whatsit.controller_test.TestWhatsitResource object at 0x7fbcc904db90>
  288. client = <FlaskClient <Flask 'app'>>
  289.  
  290.     @patch.object(
  291.         WhatsitService, "create", lambda create_request: Whatsit(**create_request)
  292.     )
  293.     def test_post(self, client: FlaskClient):  # noqa
  294.         with client:
  295.    
  296.             payload = dict(name="Test whatsit", purpose="Test purpose")
  297.             result = client.post(f"/api/{BASE_ROUTE}/whatsit/", json=payload).get_json()
  298.             expected = (
  299.                 WhatsitSchema()
  300. >               .dump(Whatsit(name=payload["name"], purpose=payload["purpose"]))
  301.                 .data
  302.             )
  303. E           AttributeError: 'dict' object has no attribute 'data'
  304.  
  305. app/other_api/whatsit/controller_test.py:55: AttributeError
  306. ___________________________________________ TestWhatsitIdResource.test_put ___________________________________________
  307.  
  308. self = <app.other_api.whatsit.controller_test.TestWhatsitIdResource object at 0x7fbcc8fd50d0>
  309. client = <FlaskClient <Flask 'app'>>
  310.  
  311.     @patch.object(WhatsitService, "get_by_id", lambda id: make_whatsit(id=id))
  312.     @patch.object(WhatsitService, "update", fake_update)
  313.     def test_put(self, client: FlaskClient):  # noqa
  314.         with client:
  315.             result = client.put(
  316.                 f"/api/{BASE_ROUTE}/whatsit/123",
  317.                 json={"name": "New Whatsit", "purpose": "New purpose"},
  318.             ).get_json()
  319.             expected = (
  320.                 WhatsitSchema()
  321.                 .dump(
  322. >                   Whatsit(whatsit_id=123, name="New Whatsit", purpose="New purpose")
  323.                 )
  324.                 .data
  325.             )
  326. E           AttributeError: 'dict' object has no attribute 'data'
  327.  
  328. app/other_api/whatsit/controller_test.py:95: AttributeError
  329. ______________________________________________ test_WhatsitSchema_works ______________________________________________
  330.  
  331. schema = <WhatsitSchema(many=False)>
  332.  
  333.     def test_WhatsitSchema_works(schema: WhatsitSchema):
  334.         params: WhatsitInterface = schema.load(
  335. >           {"whatsitId": "123", "name": "Test whatsit", "purpose": "Test purpose"}
  336.         ).data
  337. E       AttributeError: 'dict' object has no attribute 'data'
  338.  
  339. app/other_api/whatsit/schema_test.py:19: AttributeError
  340. ____________________________________________ TestWidgetResource.test_get _____________________________________________
  341.  
  342. self = <app.widget.controller_test.TestWidgetResource object at 0x7fbcc8e80c90>, client = <FlaskClient <Flask 'app'>>
  343.  
  344.     @patch.object(
  345.         WidgetService,
  346.         "get_all",
  347.         lambda: [
  348.             make_widget(123, name="Test Widget 1"),
  349.             make_widget(456, name="Test Widget 2"),
  350.         ],
  351.     )
  352.     def test_get(self, client: FlaskClient):  # noqa
  353.         with client:
  354.             results = client.get(f"/api/{BASE_ROUTE}", follow_redirects=True).get_json()
  355.             expected = (
  356.                 WidgetSchema(many=True)
  357.                 .dump(
  358.                     [
  359.                         make_widget(123, name="Test Widget 1"),
  360. >                       make_widget(456, name="Test Widget 2"),
  361.                     ]
  362.                 )
  363.                 .data
  364.             )
  365. E           AttributeError: 'list' object has no attribute 'data'
  366.  
  367. app/widget/controller_test.py:35: AttributeError
  368. ____________________________________________ TestWidgetResource.test_post ____________________________________________
  369.  
  370. self = <app.widget.controller_test.TestWidgetResource object at 0x7fbcc8e36990>, client = <FlaskClient <Flask 'app'>>
  371.  
  372.     @patch.object(
  373.         WidgetService, "create", lambda create_request: Widget(**create_request)
  374.     )
  375.     def test_post(self, client: FlaskClient):  # noqa
  376.         with client:
  377.    
  378.             payload = dict(name="Test widget", purpose="Test purpose")
  379.             result = client.post(f"/api/{BASE_ROUTE}/", json=payload).get_json()
  380.             expected = (
  381.                 WidgetSchema()
  382. >               .dump(Widget(name=payload["name"], purpose=payload["purpose"]))
  383.                 .data
  384.             )
  385. E           AttributeError: 'dict' object has no attribute 'data'
  386.  
  387. app/widget/controller_test.py:53: AttributeError
  388. ___________________________________________ TestWidgetIdResource.test_put ____________________________________________
  389.  
  390. self = <app.widget.controller_test.TestWidgetIdResource object at 0x7fbcc8dc14d0>
  391. client = <FlaskClient <Flask 'app'>>
  392.  
  393.     @patch.object(WidgetService, "get_by_id", lambda id: make_widget(id=id))
  394.     @patch.object(WidgetService, "update", fake_update)
  395.     def test_put(self, client: FlaskClient):  # noqa
  396.         with client:
  397.             result = client.put(
  398.                 f"/api/{BASE_ROUTE}/123",
  399.                 json={"name": "New Widget", "purpose": "New purpose"},
  400.             ).get_json()
  401.             expected = (
  402.                 WidgetSchema()
  403. >               .dump(Widget(widget_id=123, name="New Widget", purpose="New purpose"))
  404.                 .data
  405.             )
  406. E           AttributeError: 'dict' object has no attribute 'data'
  407.  
  408. app/widget/controller_test.py:93: AttributeError
  409. ______________________________________________ test_WidgetSchema_works _______________________________________________
  410.  
  411. schema = <WidgetSchema(many=False)>
  412.  
  413.     def test_WidgetSchema_works(schema: WidgetSchema):
  414.         params: WidgetInterface = schema.load(
  415. >           {"widgetId": "123", "name": "Test widget", "purpose": "Test purpose"}
  416.         ).data
  417. E       AttributeError: 'dict' object has no attribute 'data'
  418.  
  419. app/widget/schema_test.py:19: AttributeError
  420. =========================================== 20 failed, 58 passed in 1.22s ============================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement