Skip to content

Commit 2ba4666

Browse files
author
zkan
committed
Correct assertion and improve Python coding style a bit
1 parent f90ece8 commit 2ba4666

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

test/test_config.py

+25-23
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,31 @@ def setUp(self):
1515
def test_initialization(self):
1616
endpoint = '/inbound'
1717
port = 5000
18-
debug_mode = True
19-
keys = ['from',
20-
'attachments',
21-
'headers',
22-
'text',
23-
'envelope',
24-
'to',
25-
'html',
26-
'sender_ip',
27-
'attachment-info',
28-
'subject',
29-
'dkim',
30-
'SPF',
31-
'charsets',
32-
'content-ids',
33-
'spam_report',
34-
'spam_score',
35-
'email']
18+
keys = [
19+
'from',
20+
'attachments',
21+
'headers',
22+
'text',
23+
'envelope',
24+
'to',
25+
'html',
26+
'sender_ip',
27+
'attachment-info',
28+
'subject',
29+
'dkim',
30+
'SPF',
31+
'charsets',
32+
'content-ids',
33+
'spam_report',
34+
'spam_score',
35+
'email',
36+
]
3637
host = 'http://127.0.0.1:5000/inbound'
37-
self.assertTrue(debug_mode, self.config.debug_mode)
38-
self.assertTrue(endpoint, self.config.endpoint)
39-
self.assertTrue(host, self.config.host)
40-
self.assertTrue(port, self.config.port)
38+
39+
self.assertTrue(self.config.debug_mode)
40+
self.assertEqual(self.config.endpoint, endpoint)
41+
self.assertEqual(self.config.host, host)
42+
self.assertEqual(self.config.port, port)
4143
for key in keys:
4244
self.assertTrue(key in self.config.keys)
4345

@@ -48,7 +50,7 @@ def test_init_environment_should_set_env_from_dotenv(self):
4850
f.write('RANDOM_VARIABLE=RANDOM_VALUE')
4951
Config()
5052
os.remove(env_file_path)
51-
self.assertEqual('RANDOM_VALUE', os.environ['RANDOM_VARIABLE'])
53+
self.assertEqual(os.environ['RANDOM_VARIABLE'], 'RANDOM_VALUE')
5254

5355
def test_init_environment_should_not_set_env_if_format_is_invalid(self):
5456
config_file = sendgrid.helpers.inbound.config.__file__

0 commit comments

Comments
 (0)