示例#1
0
def getPhotoId(photoId, request):
	if photoId:
		return photoId

	if request:
		referrer = getReferrerFromRequest(request)
		photoId = flickrapi.getPhotoIdFromUrl(referrer)
		return photoId
示例#2
0
	def test_getFlickrPhotoId_None_ReturnsNone(self):
		"""
		For a None 'flickr url', returns None
		"""
		photoId = flickrapi.getPhotoIdFromUrl(None)
		self.assertEqual(photoId, None)
示例#3
0
	def test_getFlickrPhotoId_FlickrInvalidUrl_ReturnsNone(self):
		"""
		Given an invalid flickr URL, returns None
		"""
		photoId = flickrapi.getPhotoIdFromUrl("http://www.flickr.com/photos/mendhak")
		self.assertEqual(photoId, None)
示例#4
0
	def test_getFlickrPhotoId_FlickrUrlExtended_ReturnsPhotoID(self):
		"""
		Given a long Flickr URL, return the PHOTO ID
		"""
		photoId = flickrapi.getPhotoIdFromUrl("http://www.flickr.com/photos/mendhak/123456/in/photostream/lightbox/2452")
		self.assertEqual("123456", photoId)
示例#5
0
	def test_getFlickrPhotoId_FlickrURL_ReturnsPhotoID(self):
		"""
		Given a flickr photo page URL, return the Photo ID
		"""
		photoId = flickrapi.getPhotoIdFromUrl("http://flickr.com/photos/mendhak/12345")
		self.assertEqual("12345", photoId)