Skip to content

Commit

Permalink
URL Composer fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
heynemann committed Oct 24, 2012
1 parent 6ab7c3c commit 6dd10b3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 4 deletions.
2 changes: 2 additions & 0 deletions thumbor/url_composer.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def main(arguments=None):
parsed_options.vertical_flip, parsed_options.vertical_flip,
parsed_options.halign, parsed_options.halign,
parsed_options.valign, parsed_options.valign,
parsed_options.trim,
crop_left, crop_left,
crop_top, crop_top,
crop_right, crop_right,
Expand Down Expand Up @@ -125,6 +126,7 @@ def main(arguments=None):
print 'Signed URL:' print 'Signed URL:'


print url print url
return url


if __name__ == '__main__': if __name__ == '__main__':
main(sys.argv[1:]) main(sys.argv[1:])
1 change: 1 addition & 0 deletions vows/crypto_vows.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def should_equal_encrypted_string(self, (topic, expected)):
'flip_vertical': False, 'flip_vertical': False,
'halign': 'center', 'halign': 'center',
'valign': 'middle', 'valign': 'middle',
'trim': '',
'crop_left': 0, 'crop_left': 0,
'crop_top': 0, 'crop_top': 0,
'crop_right': 0, 'crop_right': 0,
Expand Down
27 changes: 23 additions & 4 deletions vows/url_composer_vows.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,9 +22,28 @@ def topic(self):
def should_be_null(self, topic): def should_be_null(self, topic):
expect(topic).to_be_null() expect(topic).to_be_null()


class WhenProperArguments(Vows.Context):
def topic(self):
return main([
"-k", "MY-SECURITY-KEY",
"-w", "200",
"-e", "300",
"myserver.com/myimg.jpg"
])

def should_be_proper_url(self, topic):
expect(topic).to_equal('/G_dykuWBGyEil5JnNh9cBke0Ajo=/200x300/myserver.com/myimg.jpg')

class WhenOldFormat(Vows.Context):
def topic(self):
return main([
"-k", "MY-SECURITY-KEY",
"-w", "200",
"-e", "300",
"--old-format",
"myserver.com/myimg.jpg"
])


#class WhenImagePassed(Vows.Context): def should_be_proper_url(self, topic):
#def topic(self): expect(topic).to_equal('/6LSog0KmY0NQg8GK4Tsti0FAR9emvaF4xfyLY3FUmOI0HVcqF8HxibsAjVCbxFfl/myserver.com/myimg.jpg')
#return main([


#])

0 comments on commit 6dd10b3

Please sign in to comment.