Module 3 is working fine when using by QEats app but after submitting Assessment Failed!

2020-03-01 18:07:51,373 unitTesting INFO Running pytest
2020-03-01 18:08:01,155 unitTesting INFO ============================= test session starts ==============================
platform linux – Python 3.6.9, pytest-5.3.1, py-1.8.0, pluggy-0.12.0
Django settings: qeats.settings (from ini file)
rootdir: /deveshshakya773-ME_QEATS_REVIEW_MP-8d2488fa-5be7-11ea-adbf-e35a92e0b338/deveshshakya773-ME_QEATS_REVIEW_MP, inifile: pytest.ini
plugins: django-3.5.1, mock-1.10.4
collected 3 items

tests/test_views.py …F [100%]

=================================== FAILURES ===================================
________________ TestSocialSharing.test_post_to_pinterest_share ________________

self = <tests.test_views.TestSocialSharing object at 0x3ecfd2db8898>

def test_post_to_pinterest_share(self):
    client = Client()
    prefix = os.getenv('USER_SOLUTION')
    if prefix is None:
        prefix = '.'

    image_path = prefix + '/tests/sneakpeak.jpg'
    img_b64 = restaurants.image_uploader.file_path_to_img64(image_path)
    import datetime
    message = 'Great Work!!! Completed module 2 @ {}'.format(str(datetime.datetime.now()))
    request_body = {
                    'imgBase64' : img_b64.decode('utf-8'),
                    'text' : message,
                    'orderId' : '0x12312',
                    'tags' : ['Pinterest', 'Module2'],
                    'share' : ['Pinterest']
                    }
    resp = client.post(r'/qeats/v1/review/share', data=request_body, content_type='application/json')
    resp.status_code == 200
    pinterest_test_util = PinterestTestUtil()
    message_expected = message + ' #Pinterest #Module2'
  assert pinterest_test_util.check_whether_message_is_published(message_expected, image_path)

E AssertionError: assert False
E + where False = <bound method PinterestTestUtil.check_whether_message_is_published of <tests.test_views.PinterestTestUtil object at 0x3ecfd2db8fd0>>(‘Great Work!!! Completed module 2 @ 2020-03-01 18:07:59.029769 #Pinterest #Module2’, ‘/deveshshakya773-ME_QEATS_REVIEW_MP-8d2488fa-5be7-11ea-adbf-e35a92e0b338/deveshshakya773-ME_QEATS_REVIEW_MP/tests/sneakpeak.jpg’)
E + where <bound method PinterestTestUtil.check_whether_message_is_published of <tests.test_views.PinterestTestUtil object at 0x3ecfd2db8fd0>> = <tests.test_views.PinterestTestUtil object at 0x3ecfd2db8fd0>.check_whether_message_is_published

tests/test_views.py:210: AssertionError
----------------------------- Captured stdout call -----------------------------

Pinterest API: Looks you have hit the per hour API limit

====================================================================================================
=============================== warnings summary ===============================
/usr/local/lib/python3.6/dist-packages/_pytest/junitxml.py:436
/usr/local/lib/python3.6/dist-packages/_pytest/junitxml.py:436: PytestDeprecationWarning: The ‘junit_family’ default value will change to ‘xunit2’ in pytest 6.0.
Add ‘junit_family=legacy’ to your pytest.ini file to silence this warning and make your suite compatible.
_issue_warning_captured(deprecated.JUNIT_XML_DEFAULT_FAMILY, config.hook, 2)

– Docs: https://docs.pytest.org/en/latest/warnings.html

  • generated xml file: /deveshshakya773-ME_QEATS_REVIEW_MP-8d2488fa-5be7-11ea-adbf-e35a92e0b338/deveshshakya773-ME_QEATS_REVIEW_MP/tests.xml -
    ==================== 1 failed, 2 passed, 1 warning in 7.91s ====================

2020-03-01 18:08:01,310 unitTesting INFO Pytest run complete
2020-03-01 18:08:01,327 unitTesting INFO Report generated: {‘tests.test_views.TestSocialSharing.test_post_to_pinterest_share’: ‘TEST_STATUS_FAILURE’, ‘tests.test_views.TestSocialSharing.test_post_to_facebook_share_cli’: ‘TEST_STATUS_SUCCESS’, ‘tests.test_views.TestSocialSharing.test_post_to_facebook_share’: ‘TEST_STATUS_SUCCESS’}

@dshakya29, you are hitting the Pinterest API limit as mentioned in the log

I have tried this thing with a new token as well.

After you create a new token, try sending a request using Postman to see if it’s working. I remember getting many new tokens due to API limit and also if that doesn’t work out, try creating a new Pinterestt app from their developer website and then use tokens made for it.

Still getting issue. Can you help? How you solved this?

Hey, was your issue resolved. Did you performed the steps which @nabhanpv suggested?

Hey, it has been more than 12 hours since we have got a reply from your side. I’m closing this query, if the problem persists feel free to raise a new query :slight_smile: