Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
axelstudios committed Sep 20, 2024
1 parent 752e127 commit 4b1a23b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion seed/models/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ def _serialize_for_extra_data(column_value):
setattr(datum, new_column.column_name, getattr(datum, self.column_name))
setattr(datum, self.column_name, None)
datum.save()
except (ValidationError, DataError):
except (ValidationError, DataError, ValueError):
return [
False,
"The column data aren't formatted properly for the new column due to type constraints (e.g., Datatime, Quantities, etc.).",
Expand Down
3 changes: 2 additions & 1 deletion seed/serializers/meter_readings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
See also https://github.com/SEED-platform/seed/blob/main/LICENSE.md
"""

from collections import OrderedDict
from typing import Tuple

import dateutil.parser
Expand Down Expand Up @@ -107,7 +108,7 @@ def create(self, validated_data) -> MeterReading:
return updated_reading

def to_representation(self, obj):
result = super().to_representation(obj)
result = OrderedDict(super().to_representation(obj))

# TODO: we need to actually read the units from the meter, then convert accordingly.
# SEED stores all energy data in kBtus
Expand Down
2 changes: 1 addition & 1 deletion seed/tests/test_audit_template_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def test_audit_template_config_create(self):
# testing one-to-one relationship
response = self.client.post(url, params, content_type="application/json")
assert response.status_code == 400
assert response.json()["errors"] == {"organization": ["This field must be unique."]}
assert response.json()["errors"] == {"organization": ["audit template config with this organization already exists."]}

def test_audit_template_config_update(self):
# Invalid params
Expand Down
2 changes: 1 addition & 1 deletion seed/tests/test_element_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def test_get_org_element_permissions(self):
self.login_as_child_member()
response = self.client.get(url)
assert response.status_code == 404
assert response.json() == {"detail": "Not found."}
assert response.json() == {"detail": "No Element matches the given query."}

# root user can see element
self.login_as_root_member()
Expand Down
2 changes: 1 addition & 1 deletion seed/tests/test_property_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def test_create_property_in_diff_org(self):
url = reverse("api:v3:properties-list") + f"?organization_id={org_2.pk}"
response = self.client.post(url, params, content_type="application/json")
self.assertEqual(response.status_code, 403)
self.assertEqual(response.json()["detail"], "You do not have permission to perform this action.")
self.assertEqual(response.json()["detail"], "Incorrect org id.")

def test_create_property_with_protected_fields(self):
state = self.property_state_factory.get_property_state()
Expand Down

0 comments on commit 4b1a23b

Please sign in to comment.