@@ -52,33 +52,6 @@ def test_set_attributes_valid_date(self, m):
52
52
53
53
self .assertTrue (hasattr (self .canvas_object , "half_offset_date" ))
54
54
self .assertEqual (self .canvas_object .half_offset_date , offset_time )
55
-
56
- # set_attributes with a hyphen
57
- def test_set_attributes_with_hyphens (self , m ):
58
- attributes = {
59
- "content-type" : "application/json" ,
60
- "filename" : "example.json" ,
61
- "start-at" : "2012-05-05T00:00:00Z" ,
62
- "end-at" : "2012-08-05" ,
63
- }
64
-
65
- start_date = datetime .strptime (
66
- attributes ["start-at" ], "%Y-%m-%dT%H:%M:%SZ"
67
- ).replace (tzinfo = pytz .utc )
68
- end_date = datetime .strptime (attributes ["end-at" ], "%Y-%m-%d" ).replace (
69
- tzinfo = pytz .utc
70
- )
71
-
72
- self .canvas_object .set_attributes (attributes )
73
-
74
- self .assertTrue (hasattr (self .canvas_object , "start_at_date" ))
75
- self .assertEqual (self .canvas_object .start_at_date , start_date )
76
- self .assertTrue (hasattr (self .canvas_object , "end_at_date" ))
77
- self .assertEqual (self .canvas_object .end_at_date , end_date )
78
- self .assertTrue (hasattr (self .canvas_object , "content_type" ))
79
- self .assertEqual (self .canvas_object .content_type , "application/json" )
80
- self .assertTrue (hasattr (self .canvas_object , "filename" ))
81
- self .assertEqual (self .canvas_object .filename , "example.json" )
82
55
83
56
def test_set_attributes_invalid_date (self , m ):
84
57
attributes = {"start_at" : "2017-01-01T00:00+00:00:00" , "end_at" : "2012-08-0" }
@@ -89,3 +62,20 @@ def test_set_attributes_invalid_date(self, m):
89
62
self .assertFalse (hasattr (self .canvas_object , "end_at_date" ))
90
63
self .assertTrue (hasattr (self .canvas_object , "start_at" ))
91
64
self .assertTrue (hasattr (self .canvas_object , "end_at" ))
65
+
66
+ # set_attributes 'content-type'
67
+ def test_set_attributes_with_content_type (self , m ):
68
+ attributes = {
69
+ "content-type" : "application/json" ,
70
+ "content_type" : "another_application/json" ,
71
+ "filename" : "example.json" ,
72
+ }
73
+
74
+ self .canvas_object .set_attributes (attributes )
75
+
76
+ self .assertTrue (hasattr (self .canvas_object , "content-type" ))
77
+ self .assertEqual (getattr (self .canvas_object , 'content-type' ), "application/json" )
78
+ self .assertTrue (hasattr (self .canvas_object , "content_type" ))
79
+ self .assertEqual (self .canvas_object .content_type , "another_application/json" )
80
+ self .assertTrue (hasattr (self .canvas_object , "filename" ))
81
+ self .assertEqual (self .canvas_object .filename , "example.json" )
0 commit comments