Skip to content

Commit

Permalink
Add failing test to demonstrate issue with content_type conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Thetwam committed Apr 29, 2024
1 parent 5c02d7e commit 51e59d1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_canvas_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,22 @@ def test_set_attributes_with_content_type(self, m):
self.assertEqual(self.canvas_object.content_type, "another_application/json")
self.assertTrue(hasattr(self.canvas_object, "filename"))
self.assertEqual(self.canvas_object.filename, "example.json")

def test_set_attributes_with_content_type_reversed(self, m):
# Reversed the order of the attributes to test overwrite behavior
attributes = {
"content_type": "another_application/json",
"content-type": "application/json",
"filename": "example.json",
}

self.canvas_object.set_attributes(attributes)

self.assertTrue(hasattr(self.canvas_object, "content-type"))
self.assertEqual(
getattr(self.canvas_object, "content-type"), "application/json"
)
self.assertTrue(hasattr(self.canvas_object, "content_type"))
self.assertEqual(self.canvas_object.content_type, "another_application/json")
self.assertTrue(hasattr(self.canvas_object, "filename"))
self.assertEqual(self.canvas_object.filename, "example.json")

0 comments on commit 51e59d1

Please sign in to comment.