Пример #1
0
    def test_04_create_many_albums(self):
        """
        Create many albums for testing.
        """

        imgurUtil = ImgurUtil()
        response1 = imgurUtil.create_album('album1')
        response2 = imgurUtil.create_album('album2')
        response3 = imgurUtil.create_album('album3')
        self.assertEqual(response1.status_code, 200)
        self.assertEqual(response2.status_code, 200)
        self.assertEqual(response3.status_code, 200)
Пример #2
0
    def test_01_create_album(self):
        """
        Create a temporary album for testing.
        """

        imgurUtil = ImgurUtil()
        response = imgurUtil.create_album('test_only')
        self.assertEqual(response.status_code, 200)
Пример #3
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)
Пример #4
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)