From 2e85c52c925972a4140d63319949c20da80da458 Mon Sep 17 00:00:00 2001 From: Krista LaFentres Date: Mon, 23 Oct 2017 15:38:14 -0500 Subject: [PATCH] Add tests for sendgrid.py apikey and api_key setters --- test/test_sendgrid.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/test_sendgrid.py b/test/test_sendgrid.py index 73b6b2935..c73c44bbf 100644 --- a/test/test_sendgrid.py +++ b/test/test_sendgrid.py @@ -79,6 +79,20 @@ def test_apikey_init(self): my_sendgrid = sendgrid.SendGridAPIClient(apikey="THISISMYKEY") self.assertEqual(my_sendgrid.apikey, "THISISMYKEY") + def test_apikey_setter(self): + sg_apikey_setter = sendgrid.SendGridAPIClient(apikey="THISISMYKEY") + self.assertEqual(sg_apikey_setter.apikey, "THISISMYKEY") + # Use apikey setter to change api key + sg_apikey_setter.apikey = "THISISMYNEWAPIKEY" + self.assertEqual(sg_apikey_setter.apikey, "THISISMYNEWAPIKEY") + + def test_api_key_setter(self): + sg_api_key_setter = sendgrid.SendGridAPIClient(apikey="THISISMYKEY") + self.assertEqual(sg_api_key_setter.apikey, "THISISMYKEY") + # Use api_key setter to change api key + sg_api_key_setter.api_key = "THISISMYNEWAPI_KEY" + self.assertEqual(sg_api_key_setter.apikey, "THISISMYNEWAPI_KEY") + def test_impersonate_subuser_init(self): temp_subuser = 'abcxyz@this.is.a.test.subuser' sg_impersonate = sendgrid.SendGridAPIClient(