1from tests.unit import unittest
2
3from boto.ses.connection import SESConnection
4from boto.ses import exceptions
5
6
7class SESConnectionTest(unittest.TestCase):
8    ses = True
9
10    def setUp(self):
11        self.ses = SESConnection()
12
13    def test_get_dkim_attributes(self):
14        response = self.ses.get_identity_dkim_attributes(['example.com'])
15        # Verify we get the structure we expect, we don't care about the
16        # values.
17        self.assertTrue('GetIdentityDkimAttributesResponse' in response)
18        self.assertTrue('GetIdentityDkimAttributesResult' in
19                        response['GetIdentityDkimAttributesResponse'])
20        self.assertTrue(
21            'DkimAttributes' in response['GetIdentityDkimAttributesResponse']
22                                        ['GetIdentityDkimAttributesResult'])
23
24    def test_set_identity_dkim_enabled(self):
25        # This api call should fail because have not verified the domain,
26        # so we can test that it at least fails we we expect.
27        with self.assertRaises(exceptions.SESIdentityNotVerifiedError):
28            self.ses.set_identity_dkim_enabled('example.com', True)
29
30    def test_verify_domain_dkim(self):
31        # This api call should fail because have not confirmed the domain,
32        # so we can test that it at least fails we we expect.
33        with self.assertRaises(exceptions.SESDomainNotConfirmedError):
34            self.ses.verify_domain_dkim('example.com')
35
36
37if __name__ == '__main__':
38    unittest.main()
39