3
3
4
4
class TestOutlookCalendar (OutlookClientTestCase ):
5
5
def test1_create_event (self ):
6
- event_info = {
7
- "Subject " : "Discuss the Calendar REST API " ,
8
- "Body " : {
9
- "ContentType " : "HTML" ,
10
- "Content " : "I think it will meet our requirements! "
6
+ event_payload = {
7
+ "subject " : "Let's go for lunch " ,
8
+ "body " : {
9
+ "contentType " : "HTML" ,
10
+ "content " : "Does late morning work for you? "
11
11
},
12
- "Start" : "2014-02-02T18:00:00-08:00" ,
13
- "StartTimeZone" : "Pacific Standard Time" ,
14
- "End" : "2014-02-02T19:00:00-08:00" ,
15
- "EndTimeZone" : "Pacific Standard Time" ,
16
- "Attendees" : [
12
+ "start" : {
13
+ "dateTime" : "2017-04-15T12:00:00" ,
14
+ "timeZone" : "Pacific Standard Time"
15
+ },
16
+ "end" : {
17
+ "dateTime" : "2017-04-15T14:00:00" ,
18
+ "timeZone" : "Pacific Standard Time"
19
+ },
20
+ "location" : {
21
+ "displayName" : "Harry's Bar"
22
+ },
23
+ "attendees" : [
17
24
{
18
- "EmailAddress " : {
19
- "Address " : "janets@a830edad9050849NDA1 .onmicrosoft.com" ,
20
- "Name " : "Janet Schorr "
25
+ "emailAddress " : {
26
+ "address " : "samanthab@contoso .onmicrosoft.com" ,
27
+ "name " : "Samantha Booth "
21
28
},
22
- "Type " : "Required "
29
+ "type " : "required "
23
30
}
24
31
]
25
32
}
26
33
27
- event = self .client .me .events .add_from_json (event_info )
34
+ event = self .client .me .events .add_from_json (event_payload )
28
35
self .client .execute_query ()
29
- self .assertIsNotNone (event .properties ["Id " ])
36
+ self .assertIsNotNone (event .properties ["id " ])
30
37
31
38
def test2_get_events (self ):
32
39
events = self .client .me .events
@@ -41,7 +48,7 @@ def test3_update_event(self):
41
48
if len (results ) == 1 :
42
49
event = results [0 ]
43
50
self .assertIsNotNone (event .properties ["subject" ])
44
- event .set_property ("Subject " , "Discuss the Calendar REST API (updated)" )
51
+ event .set_property ("subject " , "Discuss the Calendar REST API (updated)" )
45
52
event .update ()
46
53
self .client .execute_query ()
47
54
@@ -57,5 +64,5 @@ def test4_delete_event(self):
57
64
events = self .client .me .events
58
65
self .client .load (events )
59
66
self .client .execute_query ()
60
- results = [e for e in events if e .properties ["Id " ] == event .properties ["Id " ]]
67
+ results = [e for e in events if e .properties ["id " ] == event .properties ["id " ]]
61
68
self .assertEqual (len (results ), 0 )
0 commit comments