예제 #1
0
    def test_02_single_upload(self):
        """
        Test if single upload success.
        """

        imgurUtil = ImgurUtil()
        album_hash = imgurUtil.get_album_hash('test_only')
        imgurUtil.set_album_hash(album_hash)
        image_link = 'https://instagram.fbkk10-1.fna.fbcdn.net/vp/32fca421863cca50988741b338de6165/5CAFF2AE/t51.2885-19/s320x320/45476686_1153987844754206_6755756503161896960_n.jpg'
        response = imgurUtil.upload_image('temp', image_link)
        self.assertEqual(response.status_code, 200)
예제 #2
0
    def test_08_delete_single_image(self):
        """
        Test deleting a picture.
        """

        imgurUtil = ImgurUtil()
        album_hash = imgurUtil.get_album_hash('test_only')
        imgurUtil.set_album_hash(album_hash)
        hashes = imgurUtil.get_image_hash('temp')
        response = imgurUtil.delete_image(hashes)
        self.assertEqual(response.status_code, 200)
예제 #3
0
    def test_06_get_single_image(self):
        """
        Test getting an single image from test_album.
        """

        imgurUtil = ImgurUtil()
        album_title = 'test_album'
        album_hash = imgurUtil.get_album_hash(album_title)
        imgurUtil.set_album_hash(album_hash)
        response = imgurUtil.get_image_description('Catterpillar')
        description = 'Catterpillar'
        self.assertEqual(response, description)
예제 #4
0
    def test_03_multiple_upload(self):
        """
        Test if multiple upload success.
        """

        imgurUtil = ImgurUtil()
        album_hash = imgurUtil.get_album_hash('test_only')
        imgurUtil.set_album_hash(album_hash)
        image1_link = 'https://instagram.fbkk2-2.fna.fbcdn.net/vp/a7af227dd8e1cf5b352e6bf4b87cefba/5C7A4F55/t51.2885-19/s320x320/42437542_2213514032250422_4515480103911686144_n.jpg'
        image2_link = 'https://instagram.fbkk22-1.fna.fbcdn.net/vp/e8379b291ba024e9d8872ffc8de465d5/5C9493DE/t51.2885-19/s320x320/22794246_352255698554015_5072593132353224704_n.jpg'
        image3_link = 'https://instagram.fbkk2-2.fna.fbcdn.net/vp/1f1cf2cea82f1d792ca848f7b5a4597c/5C7562C1/t51.2885-19/s320x320/44392027_1870453886342960_1282978848111067136_n.jpg'
        response1 = imgurUtil.upload_image('temp2', image1_link)
        response2 = imgurUtil.upload_image('temp3', image2_link)
        response3 = imgurUtil.upload_image('temp4', image3_link)
        self.assertEqual(response1.status_code, 200)
        self.assertEqual(response2.status_code, 200)
        self.assertEqual(response3.status_code, 200)
예제 #5
0
    def test_09_delete_multiple_image(self):
        """
        Test deleting many pictures.
        """

        imgurUtil = ImgurUtil()
        album_hash = imgurUtil.get_album_hash('test_only')
        imgurUtil.set_album_hash(album_hash)
        hashes2 = imgurUtil.get_image_hash('temp2')
        hashes3 = imgurUtil.get_image_hash('temp3')
        hashes4 = imgurUtil.get_image_hash('temp4')
        response1 = imgurUtil.delete_image(hashes2)
        response2 = imgurUtil.delete_image(hashes3)
        response3 = imgurUtil.delete_image(hashes4)
        self.assertEqual(response1.status_code, 200)
        self.assertEqual(response2.status_code, 200)
        self.assertEqual(response3.status_code, 200)
예제 #6
0
    def test_12_simple_upload_process(self):
        """
        Test whole simple upload process
        """

        imgurUtil = ImgurUtil()
        album_title = 'test_2'
        create_album_response = imgurUtil.create_album(album_title)
        album_hash = imgurUtil.get_album_hash(album_title)
        imgurUtil.set_album_hash(album_hash)
        image_link = 'https://instagram.fbkk10-1.fna.fbcdn.net/vp/32fca421863cca50988741b338de6165/5CAFF2AE/t51.2885-19/s320x320/45476686_1153987844754206_6755756503161896960_n.jpg'
        upload_response = imgurUtil.upload_image('test', image_link)
        hashes = imgurUtil.get_image_hash('test')
        delete_image_response = imgurUtil.delete_image(hashes)
        delete_album_response = imgurUtil.delete_album(album_title)
        self.assertEqual(create_album_response.status_code, 200)
        self.assertEqual(upload_response.status_code, 200)
        self.assertEqual(delete_image_response.status_code, 200)
        self.assertEqual(delete_album_response.status_code, 200)
예제 #7
0
    def test_07_get_multiple_image(self):
        """
        Test getting multiple image from test_album.
        """

        imgurUtil = ImgurUtil()
        album_title = 'test_album'
        album_hash = imgurUtil.get_album_hash(album_title)
        imgurUtil.set_album_hash(album_hash)

        des1 = 'Catterpillar'
        image1_des = imgurUtil.get_image_description(des1)

        des2 = 'Sea and mountain'
        image2_des = imgurUtil.get_image_description(des2)

        des3 = 'Catty'
        image3_des = imgurUtil.get_image_description(des3)

        self.assertEqual(image1_des, des1)
        self.assertEqual(image2_des, des2)
        self.assertEqual(image3_des, des3)
예제 #8
0
    def test_13_multiple_upload_process(self):
        """
        Test multiple simple upload process
        """

        imgurUtil = ImgurUtil()
        album_title = 'test_3'
        create_album_response = imgurUtil.create_album(album_title)
        album_hash = imgurUtil.get_album_hash(album_title)
        imgurUtil.set_album_hash(album_hash)

        image_link1 = 'https://instagram.fbkk1-1.fna.fbcdn.net/vp/2e312db571e6a0b2eaaba201f54010b5/5C84466C/t51.2885-19/s320x320/26071653_402875793494059_4400556558711259136_n.jpg'
        upload_response1 = imgurUtil.upload_image('test1', image_link1)
        hashes1 = imgurUtil.get_image_hash('test1')

        image_link2 = 'https://instagram.fbkk1-1.fna.fbcdn.net/vp/dca8a4e0ef1508ef6fcc0b9046d6261a/5C896EAC/t51.2885-19/s320x320/43700894_2233080543604526_24320505716670464_n.jpg'
        upload_response2 = imgurUtil.upload_image('test2', image_link2)
        hashes2 = imgurUtil.get_image_hash('test2')

        image_link3 = 'https://instagram.fbkk1-1.fna.fbcdn.net/vp/dde581ed788603a79d4d3f73a40bc132/5C8846B6/t51.2885-19/s320x320/43661432_2011354002276624_8575559070172315648_n.jpg'
        upload_response3 = imgurUtil.upload_image('test3', image_link3)
        hashes3 = imgurUtil.get_image_hash('test3')

        delete_image_response1 = imgurUtil.delete_image(hashes1)
        delete_image_response2 = imgurUtil.delete_image(hashes2)
        delete_image_response3 = imgurUtil.delete_image(hashes3)

        delete_album_response = imgurUtil.delete_album(album_title)
        self.assertEqual(create_album_response.status_code, 200)

        self.assertEqual(upload_response1.status_code, 200)
        self.assertEqual(upload_response2.status_code, 200)
        self.assertEqual(upload_response3.status_code, 200)

        self.assertEqual(delete_image_response1.status_code, 200)
        self.assertEqual(delete_image_response2.status_code, 200)
        self.assertEqual(delete_image_response3.status_code, 200)

        self.assertEqual(delete_album_response.status_code, 200)