Assertion error : Failed Unit Testing

  1. Failed Unit Testing
    Log file says :
    ______________ TestSocialSharing.test_post_to_facebook_share_cli _______________

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

def test_post_to_facebook_share_cli(self):

    facebook = restaurants.facebook_post.Facebook()
    image_url = 'http://ksmartstatic.sify.com/cmf-1.0.0/appflow/bawarchi.com/Image/oeturjecjjdah_bigger.jpg'
    my_name = self.get_user_name()

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

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

E AssertionError: assert False
E + where False = <bound method FacebookTestUtil.check_whether_message_is_published of <tests.test_views.FacebookTestUtil object at 0x3e81128f25c0>>(‘Assessment completed FACEBOOK CLI module! @ 2020-03-08 14:39:59.676793’, ‘http://ksmartstatic.sify.com/cmf-1.0.0/appflow/bawarchi.com/Image/oeturjecjjdah_bigger.jpg’)
E + where <bound method FacebookTestUtil.check_whether_message_is_published of <tests.test_views.FacebookTestUtil object at 0x3e81128f25c0>> = <tests.test_views.FacebookTestUtil object at 0x3e81128f25c0>.check_whether_message_is_published

tests/test_views.py:119: AssertionError

  1. How much time have you spent debugging this issue?
    I have worked more than 2 hrs , still I couldn’t understand what happened.

There is some error in test_views.py

The assertion error is due to logical error.
Check whether u r able to print the message correctly or not.

my “test_views.py” has few errors, but I haven’t touched till now .
Is that a problem ?

Use the correct access token inside the json format. Ensure to update the file correctly.

Following issues will be there -

  • You are passing the wrong parameter.
  • your format of data is wrong.
  • Could you please confirm - Did you follow the TODO and add required things into views.py?

Read this -https://developers.facebook.com/docs/graph-api/reference/page/photos/#example-2

HINT- https://curl.trillworks.com/

I’m closing this topic due to no response from anyone since last 12 hours. If your query is resolved, you can mark any reply as a solution. If you still have any query, please create a new topic paste the link of this topic in the description.