@@ -8,23 +8,23 @@ defmodule SparkPost.SuppressionListTest do
8
8
9
9
import Mock
10
10
11
- test_with_mock "SuppressionList.update_one succeeds with message" ,
11
+ test_with_mock "SuppressionList.upsert_one succeeds with message" ,
12
12
HTTPoison , [ request: fn ( method , url , body , headers , opts ) ->
13
13
assert method == :put
14
14
fun = MockServer . mk_http_resp ( 200 , MockServer . get_json ( "suppressionlistupdate" ) )
15
15
fun . ( method , url , body , headers , opts )
16
16
end ] do
17
- resp = SuppressionList . update_one ( "test@marketing.com" , "non_transactional" , "test description" )
17
+ { :ok , resp } = SuppressionList . upsert_one ( "test@marketing.com" , "non_transactional" , "test description" )
18
18
assert resp == "Test response message"
19
19
end
20
20
21
- test_with_mock "SuppressionList.update_one fails with invalid type" ,
21
+ test_with_mock "SuppressionList.upsert_one fails with invalid type" ,
22
22
HTTPoison , [ request: fn ( method , url , body , headers , opts ) ->
23
23
assert method == :put
24
24
fun = MockServer . mk_http_resp ( 400 , MockServer . get_json ( "suppressionupdate_fail" ) )
25
25
fun . ( method , url , body , headers , opts )
26
26
end ] do
27
- resp = SuppressionList . update_one ( "test@marketing.com" , "bad_type" )
27
+ { :error , resp } = SuppressionList . upsert_one ( "test@marketing.com" , "bad_type" )
28
28
assert % SparkPost.Endpoint.Error { } = resp
29
29
assert resp . status_code == 400
30
30
assert resp . errors == [ % { message: "Type must be one of: 'transactional', 'non_transactional'" } ]
@@ -36,7 +36,7 @@ defmodule SparkPost.SuppressionListTest do
36
36
fun = MockServer . mk_http_resp ( 204 , "" )
37
37
fun . ( method , url , body , headers , opts )
38
38
end ] do
39
- resp = SuppressionList . delete ( "test@marketing.com" )
39
+ { :ok , resp } = SuppressionList . delete ( "test@marketing.com" )
40
40
assert resp == ""
41
41
end
42
42
@@ -46,7 +46,7 @@ defmodule SparkPost.SuppressionListTest do
46
46
fun = MockServer . mk_http_resp ( 404 , MockServer . get_json ( "suppressiondelete_fail" ) )
47
47
fun . ( method , url , body , headers , opts )
48
48
end ] do
49
- resp = SuppressionList . delete ( "test@marketing.com" )
49
+ { :error , resp } = SuppressionList . delete ( "test@marketing.com" )
50
50
assert % SparkPost.Endpoint.Error { } = resp
51
51
assert resp . status_code == 404
52
52
assert resp . errors == [ % { message: "Recipient could not be found" } ]
0 commit comments