Build failure though tags are displayed on QEats app : test_post_to_pinterest_share

  1. Describe the issue briefly
    Modified views.py (Pinterest share and added tags to message) accordingly, yet build is failing.

verified clarifai_tag_suggestions.py output, no error.
passed both facebook share unit tests

  1. How much time have you spent debugging this issue?
    (Please spend at least 15 minutes to resolve the issue on your own before posting a new topic here)
    For the Past 2 hours

  2. What is your hypothesis?
    I see response 201 in unit test logs but couldn’t figure out the error.

Please help, it’s my last milestone in the mini-project.

________________ TestSocialSharing.test_post_to_pinterest_share ________________
 self = <tests.test_views.TestSocialSharing object at 0x3e1c6d67edd8>

    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)

tests/test_views.py:235: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <tests.test_views.PinterestTestUtil object at 0x3e1c6d3a66d8>
message = 'Great Work!!! Completed module 2 @ 2020-03-01 14:56:38.434812 #Pinterest #Module2'
image_path = '/sairamcharanb-ME_QEATS_REVIEW_MP-d286e8a4-5bcc-11ea-a85d-e35a92e0b338/sairamcharanb-ME_QEATS_REVIEW_MP/tests/sneakpeak.jpg'

    def check_whether_message_is_published(self, message, image_path):
    
        user_pins = self.get_all_pins_from_board()
    
        if 'data' not in user_pins:
            print('=' * 100)
            print('\n\n\nPinterest API: Looks you have hit the per hour API limit\n\n\n')
            print('=' * 100)
            return False
    
>       for one_pin in user_pins['data']:
E       TypeError: 'NoneType' object is not iterable

tests/test_views.py:85: TypeError

hey, after getting tags in app you have to post those tags on pinterest board with particular pin so in that case you have to concatenate those tags with the pinterest pin message parameter which you are posting on pinterest board make this modification you will surely get build successful.
If you check you pinterest account, your post will be without the tags, that’s why the build fails

Thank you for quick response. Would you please tell me where do I modify this code. In pinterest_post.py?

You have to figure this one out :), can’t help you with that

I attempted to do as you suggested and my pins have tags concatenated with the messages, but my build is still failing. I could really use a hint, have been struggling with this since evening.

In views.py, Class ShareReview, def post something is missing. Add the changes that you made in class GetTags, def post to the earlier class.

Thank you so much, I could pass all the four modules.