Module 2 test case 2 failed CODE able to post reviews form Qeats also able to view my posted review in focebook post section but my testcases 2 is not passing

2.i have you spent 2 hrs in debugging this issue and also tried postman

2020-05-03 09:49:56,354 unitTesting INFO Running pytest
2020-05-03 09:50:05,039 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: /cu-16bcs2178-ME_QEATS_REVIEW_MP-6d4aef0c-8d23-11ea-98f0-4723bcc3cd80/cu-16bcs2178-ME_QEATS_REVIEW_MP, inifile: pytest.ini
plugins: django-3.5.1, mock-1.10.4
collected 2 items

tests/ F. [100%]

=================================== FAILURES ===================================
______________ TestSocialSharing.test_post_to_facebook_share_cli _______________

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

def test_post_to_facebook_share_cli(self):

    facebook = restaurants.facebook_post.Facebook()
    image_url = ''
    my_name = self.get_user_name()

    message = my_name + ' completed FACEBOOK CLI module! @ {}'.format(str(
    facebook.publish_photo_msg(message, image_url)

    facebook_test_util = FacebookTestUtil()
  assert facebook_test_util.check_whether_message_is_published(message, image_url)


self = <tests.test_views.FacebookTestUtil object at 0x3ee39788d5c0>
message = ‘Assessment completed FACEBOOK CLI module! @ 2020-05-03 09:49:59.095864’
image_path = ‘

def check_whether_message_is_published(self, message, image_path):
    user_feeds = self.get_user_feed()

    if 'error' in user_feeds:
        print("\n\n",json.dumps(user_feed, indent=4))
        return False
    for feed in user_feeds['data']:
        if 'attachments' in feed:
          if feed['message'] == message:

E KeyError: ‘message’

tests/ KeyError
----------------------------- Captured stdout call -----------------------------
Assessment completed FACEBOOK CLI module! @ 2020-05-03 09:49:59.095864
400 {‘error’: {‘message’: ‘Missing or invalid image file’, ‘type’: ‘OAuthException’, ‘code’: 324, ‘error_subcode’: 2069019, ‘is_transient’: False, ‘error_user_title’: ‘Image required’, ‘error_user_msg’: ‘Make sure that your Page post includes an image that can be used in an ad.’, ‘fbtrace_id’: ‘AHICBrhfZJFfL5mMOqHbdza’}}
Get user feed url =,message,attachments
=============================== warnings summary ===============================
/usr/local/lib/python3.6/dist-packages/_pytest/ 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:

  • generated xml file: /cu-16bcs2178-ME_QEATS_REVIEW_MP-6d4aef0c-8d23-11ea-98f0-4723bcc3cd80/cu-16bcs2178-ME_QEATS_REVIEW_MP/tests.xml -
    ==================== 1 failed, 1 passed, 1 warning in 6.36s ====================

2020-05-03 09:50:05,043 unitTesting INFO Pytest run complete
2020-05-03 09:50:05,046 unitTesting INFO Report generated: {‘tests.test_views.TestSocialSharing.test_post_to_facebook_share’: ‘TEST_STATUS_SUCCESS’, ‘tests.test_views.TestSocialSharing.test_post_to_facebook_share_cli’: ‘TEST_STATUS_FAILURE’}

  1. i think that there is problem in your test case 2 that is "TestSocialSharing.test_post_to_facebook_share_cli " the image url given in automated test case does not open
    image_url =" " i tried to open the image url but it show the following

error of image url

due to which error

400 {‘error’: {‘message’: ‘Missing or invalid image file’, ‘type’: ‘OAuthException’, ‘code’: 324, ‘error_subcode’: 2069019, ‘is_transient’: False, ‘error_user_title’: ‘Image required’, ‘error_user_msg’: 'Make sure that your Page post includes an image that can be used in an ad.’, ‘fbtrace_id’: ‘AHICBrhfZJFfL5mMOqHbdza’}}
Get user feed url =,message,attachments

thats why test case test not passes because image parameter image url is not valid.

plz update or rectify test case case 2 problem

Looks like you are facing challenges in the current module.

Below is a link to all the FAQ’s for the current module

Below are a few similar topics raised by other users which you might find usefull

Note - This is a BETA Feature,if you find this helpful, kindly let us know.
Feedback link -

Kindly mark this as a solution if this has helped you solve your query

  1. The first test case is regrading the API call you make to post an image on a Facebook page.
    Check the following for this:-

You are using the access token and page ID while making the API call.

The URL you are using to make an API call is correct.

There might be an issue with the image URL that you are supplying. Please ensure that the image URL is correct and you are not using the base64 image URL.

Closing this topic as your issue is resolved by the mentor. If it is still not resolved, Kindly un-mark the accepted solution or create a new topic and post this question as a reference link in the description of the new topic.