Skip to content

Commit

Permalink
Make observations datetimes timezone aware in test to get rid of warn…
Browse files Browse the repository at this point in the history
…ing messages
  • Loading branch information
eheinrich committed Jul 26, 2019
1 parent f3541cc commit b43ed95
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions observation_portal/observations/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def test_delete_observation_leaves_request(self):
observation = Observation.objects.get(pk=obj_json['id'])
observation.state = 'CANCELED'
observation.save()
Observation.delete_old_observations(datetime(2099, 1, 1))
Observation.delete_old_observations(datetime(2099, 1, 1, tzinfo=timezone.utc))
request = Request.objects.get(id=obj_json['request']['id'])
self.assertEqual(request.id, obj_json['request']['id'])
with self.assertRaises(Observation.DoesNotExist):
Expand All @@ -315,7 +315,7 @@ def test_cant_delete_observation_with_started_configuration_statuses(self):
configuration_status = observation.configuration_statuses.all()[0]
configuration_status.state = 'ATTEMPTED'
configuration_status.save()
Observation.delete_old_observations(datetime(2099, 1, 1))
Observation.delete_old_observations(datetime(2099, 1, 1, tzinfo=timezone.utc))
observation = Observation.objects.get(pk=obj_json['id'])
self.assertEqual(observation.id, obj_json['id'])

Expand Down Expand Up @@ -1146,11 +1146,11 @@ def setUp(self):

def _add_observation(self, state, time_completed):
observation = Observation.objects.create(request=self.requestgroup.requests.first(), state=state, site='tst', enclosure='domb', telescope='1m0a',
start=datetime(2016,9,5,22,35,39), end=datetime(2016,9,5,23,35,40))
start=datetime(2016,9,5,22,35,39, tzinfo=timezone.utc), end=datetime(2016,9,5,23,35,40, tzinfo=timezone.utc))
config_status = ConfigurationStatus.objects.create(observation=observation, configuration=self.requestgroup.requests.first().configurations.first(),
state=state, instrument_name='xx03', guide_camera_name='xx03')
Summary.objects.create(configuration_status=config_status, start=datetime(2016,9,5,22,35,39),
end=datetime(2016,9,5,23,35,40), time_completed=time_completed, state=state)
Summary.objects.create(configuration_status=config_status, start=datetime(2016,9,5,22,35,39, tzinfo=timezone.utc),
end=datetime(2016,9,5,23,35,40, tzinfo=timezone.utc), time_completed=time_completed, state=state)
return observation

def test_with_no_obs_command_reports_no_time_used(self):
Expand Down

0 comments on commit b43ed95

Please sign in to comment.