@@ -8,23 +8,23 @@ defmodule SparkPost.SuppressionListTest do
88
99 import Mock
1010
11- test_with_mock "SuppressionList.update_one succeeds with message" ,
11+ test_with_mock "SuppressionList.upsert_one succeeds with message" ,
1212 HTTPoison , [ request: fn ( method , url , body , headers , opts ) ->
1313 assert method == :put
1414 fun = MockServer . mk_http_resp ( 200 , MockServer . get_json ( "suppressionlistupdate" ) )
1515 fun . ( method , url , body , headers , opts )
1616 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" )
1818 assert resp == "Test response message"
1919 end
2020
21- test_with_mock "SuppressionList.update_one fails with invalid type" ,
21+ test_with_mock "SuppressionList.upsert_one fails with invalid type" ,
2222 HTTPoison , [ request: fn ( method , url , body , headers , opts ) ->
2323 assert method == :put
2424 fun = MockServer . mk_http_resp ( 400 , MockServer . get_json ( "suppressionupdate_fail" ) )
2525 fun . ( method , url , body , headers , opts )
2626 end ] do
27- resp = SuppressionList . update_one ( "test@marketing.com" , "bad_type" )
27+ { :error , resp } = SuppressionList . upsert_one ( "test@marketing.com" , "bad_type" )
2828 assert % SparkPost.Endpoint.Error { } = resp
2929 assert resp . status_code == 400
3030 assert resp . errors == [ % { message: "Type must be one of: 'transactional', 'non_transactional'" } ]
@@ -36,7 +36,7 @@ defmodule SparkPost.SuppressionListTest do
3636 fun = MockServer . mk_http_resp ( 204 , "" )
3737 fun . ( method , url , body , headers , opts )
3838 end ] do
39- resp = SuppressionList . delete ( "test@marketing.com" )
39+ { :ok , resp } = SuppressionList . delete ( "test@marketing.com" )
4040 assert resp == ""
4141 end
4242
@@ -46,7 +46,7 @@ defmodule SparkPost.SuppressionListTest do
4646 fun = MockServer . mk_http_resp ( 404 , MockServer . get_json ( "suppressiondelete_fail" ) )
4747 fun . ( method , url , body , headers , opts )
4848 end ] do
49- resp = SuppressionList . delete ( "test@marketing.com" )
49+ { :error , resp } = SuppressionList . delete ( "test@marketing.com" )
5050 assert % SparkPost.Endpoint.Error { } = resp
5151 assert resp . status_code == 404
5252 assert resp . errors == [ % { message: "Recipient could not be found" } ]
0 commit comments