Skip to content

Commit

Permalink
tests: expand test_update_analyses for SModelS
Browse files Browse the repository at this point in the history
* Test SModelS endpoint including new bulk subscription feature.
  • Loading branch information
GraemeWatt committed Oct 31, 2024
1 parent 6980564 commit 1a2e920
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion tests/records_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
get_inspire_records_updated_on, update_record_info, RECORDS_PER_PAGE
from hepdata.modules.inspire_api.views import get_inspire_record_information
from hepdata.config import CFG_TMPDIR
from hepdata.modules.records.subscribers.api import is_current_user_subscribed_to_record


def test_record_creation(app):
Expand Down Expand Up @@ -1030,7 +1031,7 @@ def test_create_breadcrumb_text():


def test_update_analyses(app):
""" Test update of Rivet analyses """
""" Test update of Rivet, MadAnalyses 5 and SModelS analyses """

# Import a record that already has a Rivet analysis attached (but with '#' in the URL)
import_records(['ins1203852'], synchronous=True)
Expand Down Expand Up @@ -1059,6 +1060,20 @@ def test_update_analyses(app):
assert len(analysis_resources) == 1
assert analysis_resources[0].file_location == 'https://doi.org/10.14428/DVN/I2CZWU'

# Import a record that has an associated SModelS analysis
import_records(['ins1847779'], synchronous=True)
analysis_resources = DataResource.query.filter_by(file_type='SModelS').all()
assert len(analysis_resources) == 0
user = User(email='[email protected]', password='hello1', active=True, id=7766)
db.session.add(user)
db.session.commit()
update_analyses('SModelS')
analysis_resources = DataResource.query.filter_by(file_type='SModelS').all()
assert len(analysis_resources) == 1
assert analysis_resources[0].file_location == 'https://smodels.github.io/docs/ListOfAnalyses#ATLAS-EXOT-2018-06'
submission = get_latest_hepsubmission(inspire_id='1847779', overall_status='finished')
assert is_current_user_subscribed_to_record(submission.publication_recid, user)


def test_generate_license_data_by_id(app):
"""
Expand Down

0 comments on commit 1a2e920

Please sign in to comment.