Fix test_attribute api unit test. Update Changelog

This commit is contained in:
Griatch 2025-12-18 12:42:37 +01:00
parent 71268b011c
commit fafcbf291f
2 changed files with 27 additions and 21 deletions

View file

@ -21,30 +21,36 @@
- [Fix][pull3836]: Correctly handling calling `create_object` with `key=None` (count-infinity)
- [Fix][pull3852]: Django 5.2+ was not properly detected. Fixing distutils being
removed in py3.12 for new installs (count-infinity)
- [Fix][pull3845]: Fix exponential ANSI markup explosions when slicing
ANSIString after reset (speeds up EvForm other string ops, fixes compatibility) (count-infinity)
- [Fix][pull3853]: Properly handle multimatch separations with native dashes, like
't-shirt-1' (count-infinity)
- [Doc][pull3801]: Move Evennia doc build system to latest Sphinx/myST
(PowershellNinja, also honorary mention to electroglyph)
- [Doc][pull3800]: Describe support for Telnet SSH in HAProxy documentation (holl0wstar)
- [Doc][pull3825]: Update Portuguese translation (marado)
- [Doc][pull3826]: Fix broken links in README (marado)
- Docs: marado, Griatch, Hasna878
- Docs: marado, Griatch, Hasna878, count-infinity
[pull3799]: https://github.com/evennia/evennia/issues/3799
[pull3800]: https://github.com/evennia/evennia/issues/3800
[pull3801]: https://github.com/evennia/evennia/issues/3801
[pull3806]: https://github.com/evennia/evennia/issues/3806
[pull3809]: https://github.com/evennia/evennia/issues/3809
[pull3811]: https://github.com/evennia/evennia/issues/3811
[pull3815]: https://github.com/evennia/evennia/issues/3815
[pull3817]: https://github.com/evennia/evennia/issues/3817
[pull3818]: https://github.com/evennia/evennia/issues/3818
[pull3825]: https://github.com/evennia/evennia/issues/3825
[pull3826]: https://github.com/evennia/evennia/issues/3826
[pull3831]: https://github.com/evennia/evennia/issues/3831
[pull3832]: https://github.com/evennia/evennia/issues/3832
[pull3834]: https://github.com/evennia/evennia/issues/3834
[pull3836]: https://github.com/evennia/evennia/issues/3836
[pull3599]: https://github.com/evennia/evennia/issues/3599
[pull3852]: https://github.com/evennia/evennia/issues/3852
[pull3799]: https://github.com/evennia/evennia/pull/3799
[pull3800]: https://github.com/evennia/evennia/pull/3800
[pull3801]: https://github.com/evennia/evennia/pull/3801
[pull3806]: https://github.com/evennia/evennia/pull/3806
[pull3809]: https://github.com/evennia/evennia/pull/3809
[pull3811]: https://github.com/evennia/evennia/pull/3811
[pull3815]: https://github.com/evennia/evennia/pull/3815
[pull3817]: https://github.com/evennia/evennia/pull/3817
[pull3818]: https://github.com/evennia/evennia/pull/3818
[pull3825]: https://github.com/evennia/evennia/pull/3825
[pull3826]: https://github.com/evennia/evennia/pull/3826
[pull3831]: https://github.com/evennia/evennia/pull/3831
[pull3832]: https://github.com/evennia/evennia/pull/3832
[pull3834]: https://github.com/evennia/evennia/pull/3834
[pull3836]: https://github.com/evennia/evennia/pull/3836
[pull3599]: https://github.com/evennia/evennia/pull/3599
[pull3852]: https://github.com/evennia/evennia/pull/3852
[pull3853]: https://github.com/evennia/evennia/pull/3853
[pull3854]: https://github.com/evennia/evennia/pull/3853
## Evennia 5.0.1

View file

@ -174,17 +174,17 @@ class TestEvenniaRESTApi(BaseEvenniaTest):
with self.subTest(msg=f"Testing {view.view_name}"):
view_url = reverse(f"api:{view.view_name}", kwargs={"pk": view.obj.pk})
# check failures from not sending required fields
response = self.client.post(view_url)
response = self.client.put(view_url)
self.assertEqual(response.status_code, 400, f"Response was: {response.data}")
# test adding an attribute
self.assertEqual(view.obj.db.some_test_attr, None)
attr_name = "some_test_attr"
attr_data = {"db_key": attr_name, "db_value": "test_value"}
response = self.client.post(view_url, data=attr_data)
response = self.client.put(view_url, data=attr_data)
self.assertEqual(response.status_code, 200, f"Response was: {response.data}")
self.assertEqual(view.obj.attributes.get(attr_name), "test_value")
# now test removing it
attr_data = {"db_key": attr_name}
response = self.client.post(view_url, data=attr_data)
response = self.client.put(view_url, data=attr_data)
self.assertEqual(response.status_code, 200, f"Response was: {response.data}")
self.assertEqual(view.obj.attributes.get(attr_name), None)