Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
Add tiff_url to Item model
Browse files Browse the repository at this point in the history
  • Loading branch information
JPrevost committed Oct 29, 2015
1 parent 6b994ef commit 03b0bec
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions kepler/models.py
Expand Up @@ -40,6 +40,7 @@ class Item(db.Model):
handle = db.Column(db.Unicode(255))
access = db.Column(db.Enum(u'Public', u'Restricted'), default=u'Public')
jobs = db.relationship('Job', backref='item', lazy='dynamic')
tiff_url = db.Column(db.Unicode(255))

def __repr__(self):
return '<Item #%d: %r>' % (self.id, self.uri)
2 changes: 1 addition & 1 deletion kepler/tasks.py
Expand Up @@ -102,7 +102,7 @@ def get_geotiff_url_from_dspace(job):
if len(tif_urls) != 1:
raise Exception('Expected 1 tiff, found ' + str(len(tif_urls)))
else:
job.item.geotiff_url = tif_urls[0]
job.item.tiff_url = tif_urls[0]

db.session.commit()

Expand Down
4 changes: 4 additions & 0 deletions tests/test_models.py
Expand Up @@ -84,3 +84,7 @@ def testItemHasLayerId(self, db):
def testItemHasHandle(self, db):
item = Item(handle='http://hdl.handle.net/123456789/3')
assert item.handle == 'http://hdl.handle.net/123456789/3'

def testItemHasTiffUrl(self, db):
item = Item(tiff_url='http://example.com/bitstream/handle/1234.5/67890/248077.tif?sequence=4')
assert item.tiff_url == 'http://example.com/bitstream/handle/1234.5/67890/248077.tif?sequence=4'
2 changes: 1 addition & 1 deletion tests/test_tasks.py
Expand Up @@ -63,7 +63,7 @@ def testGetGeotiffUrlFromDspaceAddsGeotiffUrlToItem(job, oai_ore):
text=oai_ore)
job.item.handle = 'http://hdl.handle.net/1234.5/67890'
get_geotiff_url_from_dspace(job)
assert job.item.geotiff_url == 'http://example.com/bitstream/handle/1234.5/67890/248077.tif?sequence=4'
assert job.item.tiff_url == 'http://example.com/bitstream/handle/1234.5/67890/248077.tif?sequence=4'


def testGetGeotiffUrlFromDspaceErrorsOnNoTiffs(job, oai_ore_no_tiffs):
Expand Down

0 comments on commit 03b0bec

Please sign in to comment.