@@ -17,74 +17,74 @@ import XCTest
17
17
18
18
class SESTests : XCTestCase {
19
19
static let eventBody = """
20
+ {
21
+ " Records " : [
20
22
{
21
- " Records " : [
22
- {
23
- " eventSource " : " aws:ses " ,
24
- " eventVersion " : " 1.0 " ,
25
- " ses " : {
26
- " mail " : {
27
- " commonHeaders " : {
28
- " date " : " Wed, 7 Oct 2015 12:34:56 -0700 " ,
29
- " from " : [
30
-
31
- ],
32
- " messageId " : " <0123456789example.com> " ,
33
- " returnPath " : " [email protected] " ,
34
- " subject " : " Test Subject " ,
35
- " to " : [
36
-
37
- ]
38
- },
39
- " destination " : [
40
-
41
- ],
42
- " headers " : [
43
- {
44
- " name " : " Return-Path " ,
45
-
46
- },
47
- {
48
- " name " : " Received " ,
49
- " value " : " from mailer.example.com (mailer.example.com [203.0.113.1]) by inbound-smtp.eu-west-1.amazonaws.com with SMTP id o3vrnil0e2ic28trm7dfhrc2v0cnbeccl4nbp0g1 for [email protected] ; Wed, 07 Oct 2015 12:34:56 +0000 (UTC) "
50
- }
51
- ],
52
- " headersTruncated " : true,
53
- " messageId " : " 5h5auqp1oa1bg49b2q8f8tmli1oju8pcma2haao1 " ,
54
-
55
- " timestamp " : " 1970-01-01T00:00:00.000Z "
23
+ " eventSource " : " aws:ses " ,
24
+ " eventVersion " : " 1.0 " ,
25
+ " ses " : {
26
+ " mail " : {
27
+ " commonHeaders " : {
28
+ " date " : " Wed, 7 Oct 2015 12:34:56 -0700 " ,
29
+ " from " : [
30
+
31
+ ],
32
+ " messageId " : " <0123456789example.com> " ,
33
+ " returnPath " : " [email protected] " ,
34
+ " subject " : " Test Subject " ,
35
+ " to " : [
36
+
37
+ ]
38
+ },
39
+ " destination " : [
40
+
41
+ ],
42
+ " headers " : [
43
+ {
44
+ " name " : " Return-Path " ,
45
+
56
46
},
57
- " receipt " : {
58
- " action " : {
59
- " functionArn " : " arn:aws:lambda:eu-west-1:123456789012:function:Example " ,
60
- " invocationType " : " Event " ,
61
- " type " : " Lambda "
62
- },
63
- " dkimVerdict " : {
64
- " status " : " PASS "
65
- },
66
- " processingTimeMillis " : 574,
67
- " recipients " : [
68
-
69
-
70
- ],
71
- " spamVerdict " : {
72
- " status " : " PASS "
73
- },
74
- " spfVerdict " : {
75
- " status " : " PROCESSING_FAILED "
76
- },
77
- " timestamp " : " 1970-01-01T00:00:00.000Z " ,
78
- " virusVerdict " : {
79
- " status " : " FAIL "
80
- }
47
+ {
48
+ " name " : " Received " ,
49
+ " value " : " from mailer.example.com (mailer.example.com [203.0.113.1]) by inbound-smtp.eu-west-1.amazonaws.com with SMTP id o3vrnil0e2ic28trm7dfhrc2v0cnbeccl4nbp0g1 for [email protected] ; Wed, 07 Oct 2015 12:34:56 +0000 (UTC) "
81
50
}
51
+ ],
52
+ " headersTruncated " : true,
53
+ " messageId " : " 5h5auqp1oa1bg49b2q8f8tmli1oju8pcma2haao1 " ,
54
+
55
+ " timestamp " : " 1970-01-01T00:00:00.000Z "
56
+ },
57
+ " receipt " : {
58
+ " action " : {
59
+ " functionArn " : " arn:aws:lambda:eu-west-1:123456789012:function:Example " ,
60
+ " invocationType " : " Event " ,
61
+ " type " : " Lambda "
62
+ },
63
+ " dkimVerdict " : {
64
+ " status " : " PASS "
65
+ },
66
+ " processingTimeMillis " : 574,
67
+ " recipients " : [
68
+
69
+
70
+ ],
71
+ " spamVerdict " : {
72
+ " status " : " PASS "
73
+ },
74
+ " spfVerdict " : {
75
+ " status " : " PROCESSING_FAILED "
76
+ },
77
+ " timestamp " : " 1970-01-01T00:00:00.000Z " ,
78
+ " virusVerdict " : {
79
+ " status " : " FAIL "
82
80
}
83
81
}
84
- ]
82
+ }
85
83
}
86
- """
87
-
84
+ ]
85
+ }
86
+ """
87
+
88
88
func testSimpleEventFromJSON( ) {
89
89
let data = Data ( SESTests . eventBody. utf8)
90
90
var event : SES . Event ?
@@ -112,7 +112,7 @@ class SESTests: XCTestCase {
112
112
XCTAssertEqual ( record. ses. mail. messageId, " 5h5auqp1oa1bg49b2q8f8tmli1oju8pcma2haao1 " )
113
113
XCTAssertEqual ( record
. ses
. mail
. source
, " [email protected] " )
114
114
XCTAssertEqual ( record. ses. mail. timestamp. description, " 1970-01-01 00:00:00 +0000 " )
115
-
115
+
116
116
XCTAssertEqual ( record. ses. receipt. action. functionArn, " arn:aws:lambda:eu-west-1:123456789012:function:Example " )
117
117
XCTAssertEqual ( record. ses. receipt. action. invocationType, " Event " )
118
118
XCTAssertEqual ( record. ses. receipt. action. type, " Lambda " )
0 commit comments