diff --git a/seed/models/columns.py b/seed/models/columns.py index c2c744ffcb..7619e7e1a2 100644 --- a/seed/models/columns.py +++ b/seed/models/columns.py @@ -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.).", diff --git a/seed/serializers/meter_readings.py b/seed/serializers/meter_readings.py index b651c5016d..dbbbbed9ba 100644 --- a/seed/serializers/meter_readings.py +++ b/seed/serializers/meter_readings.py @@ -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 @@ -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 diff --git a/seed/tests/test_audit_template_configs.py b/seed/tests/test_audit_template_configs.py index 3e3437af15..aa311b648b 100644 --- a/seed/tests/test_audit_template_configs.py +++ b/seed/tests/test_audit_template_configs.py @@ -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 diff --git a/seed/tests/test_element_views.py b/seed/tests/test_element_views.py index cfd4ec14f0..eeb7ed395c 100644 --- a/seed/tests/test_element_views.py +++ b/seed/tests/test_element_views.py @@ -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() diff --git a/seed/tests/test_property_views.py b/seed/tests/test_property_views.py index 970c414262..85e5041a90 100644 --- a/seed/tests/test_property_views.py +++ b/seed/tests/test_property_views.py @@ -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()