Skip to content

Commit

Permalink
Convert remaining tests to use local database sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
viiru- committed Feb 13, 2024
1 parent ccbca69 commit c3ba970
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions pytrainer/test/core/test_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def setUp(self):
self.uc.set_us(False)
self.service = ActivityService(pytrainer_main=main)
records_table = DeclarativeBase.metadata.tables['records']
self.ddbb.session.execute(records_table.insert(), {
self.session.execute(records_table.insert(), {
'distance': 46.18,
'maxspeed': 44.6695617695,
'maxpace': 1.2,
Expand All @@ -57,7 +57,7 @@ def setUp(self):
'sport': 1,
'maxbeats': 120.0})
laps_table = DeclarativeBase.metadata.tables['laps']
self.ddbb.session.execute(laps_table.insert(), {
self.session.execute(laps_table.insert(), {
'distance': 46181.9,
'lap_number': 0,
'calories': 1462,
Expand Down
4 changes: 2 additions & 2 deletions pytrainer/test/imports/test_garmintcxv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def test_workout_summary(self):
def test_summary_in_database(self):
summary = [(0, True, '2012-10-14T12:02:42', '10.12', '00:39:51', 'Running')]
activity = Activity(date_time_utc='2012-10-14T10:02:42Z', sport_id='1')
self.ddbb.session.add(activity)
self.ddbb.session.commit()
self.session.add(activity)
self.session.commit()
current_path = os.path.dirname(os.path.abspath(__file__))
tcx_file = current_path + "/sample.tcx"
garmin_tcxv2 = import_plugin_class(self.environment, self.parent, "file_garmintcxv2.py")
Expand Down
4 changes: 2 additions & 2 deletions pytrainer/test/plugins/test_garmin-tcxv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def test_not_inDatabase(self):

def test_inDatabase(self):
activity = Activity(date_time_utc='2012-10-14T10:02:42.000Z', sport_id='1')
self.ddbb.session.add(activity)
self.ddbb.session.commit()
self.session.add(activity)
self.session.commit()
self.assertTrue(self.plugin.inDatabase(self.activity))

def test_detailsFromTCX(self):
Expand Down

0 comments on commit c3ba970

Please sign in to comment.