Skip to content

Commit

Permalink
Fixing file/source bug #1627 and adding a test for it
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderWatzinger committed Jan 5, 2022
1 parent 93b5efa commit 9a73ab2
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from openatlas import app

VERSION = '7.0.0'
VERSION = '7.0.1'
DATABASE_VERSION = '6.6.0'
DEMO_MODE = False # If activated some options are disabled, login is pre filled
IS_UNIT_TEST = False
Expand Down
3 changes: 3 additions & 0 deletions install/upgrade/upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ is working.

service apache2 restart

### 7.0.0 to 7.0.1
A code base update (e.g. with git pull) and an Apache restart is sufficient.

### 6.6.x to 7.0.0
WARNING - this is a major release and requires software upgrades. If you are
using Debian upgrade it to 11 (bullseye).
Expand Down
3 changes: 2 additions & 1 deletion openatlas/forms/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,8 @@ def process_origin_data(
'return_link_id': True,
'inverse': True})
elif entity.class_.name == 'file' \
or entity.class_.view in ['reference', 'source']:
or (entity.class_.view in ['reference', 'source']
and origin.class_.name != 'file'):
data['links']['insert'].append({
'property': 'P67',
'range': origin,
Expand Down
3 changes: 3 additions & 0 deletions openatlas/util/changelog.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
class Changelog:

versions = {
'7.0.1': ['2022-01-05', {
'fix': {
'1627': 'Error when creating a source from file view'}}],
'7.0.0': ['2022-01-01', {
'feature': {
'1566': 'Update OpenAtlas software to Debian/bullseye',
Expand Down
10 changes: 10 additions & 0 deletions tests/test_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,16 @@ def test_event(self) -> None:
follow_redirects=True)
assert b'Updated file' in rv.data

# Create source coming from file
self.app.post(
url_for('insert', class_='source', origin_id=file_id),
data={'name': 'Created source coming from file'})
with app.test_request_context():
app.preprocess_request() # type: ignore
source_id = Entity.get_by_class('source')[0].id
rv = self.app.get(url_for('view', id_=source_id))
assert b'Created source coming from file' in rv.data

# Delete
for file in files:
rv = self.app.get(
Expand Down

0 comments on commit 9a73ab2

Please sign in to comment.