Beispiel #1
0
    def test_original_dimensions(self):
        """Tests the original dimensions."""

        with _request_context('/'):
            photo = Photos.by_id(2771566478)

            assert photo.title == "Anna, Julia"
            assert photo.url.original == \
            "http://farm4.static.flickr.com/3161/2771566478_de1bd165a0_o.jpg"
            assert photo.horizontal == False
            assert int(photo.height_o) == 768

            photo2 = Photos.by_id(2771569486)
            assert photo2.horizontal == True
            assert int(photo2.height_o) == 1024
Beispiel #2
0
    def test_basic_query(self):
        """Tests a basic photo query."""

        counter = 0
        with _request_context('/'):
            for photo in Photos.by_tag("strand050708"):
                counter += 1

        assert counter > 0, "No photos yielded."
Beispiel #3
0
def photo_toggle_orientation(photo_id):
    """
    Toggles the vertical/horizontal orientation of a photo.
    """

    photo = Photos.by_id(photo_id)
    photo.horizontal = int(photo.horizontal == False)
    photo.save()
    return photo.horizontal and 'horizontal' or 'vertical'
Beispiel #4
0
    def test_photo_object(self):
        """Tests photo object."""

        with _request_context('/'):
            photo = Photos.by_id(2765703256)

            assert photo.title == "Jan"
            assert photo.id == "2765703256"
            assert photo.url.small_square == \
            "http://farm4.static.flickr.com/3156/2765703256_1e70b3f475_s.jpg"