Skip to content

Commit

Permalink
Have made the recommended alterations
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveScorfield committed Sep 5, 2023
1 parent 6122c37 commit fa51345
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions tests/controllers/test_collection_instrument.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,13 @@ def test_get_instrument_by_incorrect_id(self):
# Then that instrument is not found
self.assertEqual(instrument, None)

def test_remove_only_eq_not_seft_cis(self):
def test_update_exercise_eq_instruments_doesnt_remove_seft(self):
# Given there is an instrument in the db for a SEFT
# And an eQ is added to collection exercise id
# When an eQ is added to collection exercise id
self._add_instrument_data(ci_type="EQ")

# Then the user unselects this eQ and exercise instrument is updated
self.collection_instrument.update_exercise_eq_instruments("db0711c3-0ac8-41d3-ae0e-567e5ea1ef87", [])
self.collection_instrument.update_exercise_eq_instruments(COLLECTION_EXERCISE_ID, [])

# And the eQ is removed but the SEFT is still present
instrument = self.collection_instrument.get_instrument_json(str(self.instrument_id))
Expand Down Expand Up @@ -273,18 +273,6 @@ def _add_instrument_to_exercise(self, session=None, ci_type="EQ", exercise_id=CO
self._add_seft_details(instrument)
session.add(instrument)

@with_db_session
def _update_instrument_data(self, session=None, ci_type="SEFT", exercise_id=COLLECTION_EXERCISE_ID):
instrument = InstrumentModel(ci_type=ci_type)
exercise = ExerciseModel(exercise_id=exercise_id)
instrument.exercises.append(exercise)
if ci_type == "SEFT":
self._add_seft_details(instrument)
survey = SurveyModel(survey_id="cb0711c3-0ac8-41d3-ae0e-567e5ea1ef87")
instrument.survey = survey
session.add(instrument)
return instrument

@staticmethod
@with_db_session
def _query_exercise_by_id(exercise_id, session):
Expand Down

0 comments on commit fa51345

Please sign in to comment.