示例#1
0
 def test_add(self):
     """CTMS.add calls POST /ctms."""
     created = {
         "email": {"basket_token": "a-new-user", "email_id": "a-new-email_id"}
     }
     interface = mock_interface("POST", 201, created)
     ctms = CTMS(interface)
     assert ctms.add({"token": "a-new-user"}) == created
     interface.session.post.assert_called_once_with(
         "/ctms", json={"email": {"basket_token": "a-new-user"}}
     )
示例#2
0
 def test_add_no_interface(self):
     """If the interface is None (disabled or other issue), None is returned."""
     ctms = CTMS(None)
     assert ctms.add({"token": "a-new-user"}) is None