Skip to content

Commit 383b910

Browse files
Updated code to comply with Python code standard.
1 parent a6817d1 commit 383b910

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

tests/test_webservice.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
import MailboxValidator
77

8-
def testinvalidapikey(global_data):
9-
mbv = MailboxValidator.SingleValidation(global_data["apikey"])
8+
def test_invalid_api_key(global_data):
9+
mbv = MailboxValidator.EmailValidation(global_data["apikey"])
1010
results = mbv.ValidateEmail('example@example.com')
1111
assert results['error_message'] == 'API key not found.'
1212

13-
def testapikeyexist(global_data, capsys):
13+
def test_api_key_exist(global_data, capsys):
1414
if (global_data["apikey"] == 'YOUR_API_KEY'):
1515
with capsys.disabled():
1616
print ("You could enter a MailboxValidator API Key in tests/conftest.py for real web service calling test.")
@@ -19,36 +19,36 @@ def testapikeyexist(global_data, capsys):
1919
else:
2020
assert global_data["apikey"] != "YOUR_API_KEY"
2121

22-
def testfunctionexist(global_data):
23-
mbv = MailboxValidator.SingleValidation(global_data["apikey"])
22+
def test_function_exist(global_data):
23+
mbv = MailboxValidator.EmailValidation(global_data["apikey"])
2424
errors = []
25-
functions_list = ['ValidateEmail', 'DisposableEmail', 'FreeEmail']
25+
functions_list = ['validate_email', 'is_disposable_email', 'is_free_email']
2626
for x in range(len(functions_list)):
2727
# assert hasattr(mbv, functions_list[x]) == True, "Function did not exist."
28-
if (hasattr(mbv, functions_list[x]) == False):
28+
if (hasattr(mbv, functions_list[x]) is False):
2929
errors.append("Function " + functions_list[x] + " did not exist.")
3030
# assert no error message has been registered, else print messages
3131
assert not errors, "errors occured:\n{}".format("\n".join(errors))
3232

33-
def testvalidateemail(global_data):
34-
mbv = MailboxValidator.SingleValidation(global_data["apikey"])
35-
results = mbv.ValidateEmail('example@example.com')
33+
def test_validate_email(global_data):
34+
mbv = MailboxValidator.EmailValidation(global_data["apikey"])
35+
results = mbv.validate_email('example@example.com')
3636
if (global_data["apikey"] == 'YOUR_API_KEY'):
3737
assert results['error_code'] == "101"
3838
else:
3939
assert results['status'] == "False"
4040

41-
def testdisposableemail(global_data):
42-
mbv = MailboxValidator.SingleValidation(global_data["apikey"])
43-
results = mbv.DisposableEmail('example@example.com')
41+
def test_disposable_email(global_data):
42+
mbv = MailboxValidator.EmailValidation(global_data["apikey"])
43+
results = mbv.is_disposable_email('example@example.com')
4444
if (global_data["apikey"] == 'YOUR_API_KEY'):
4545
assert results['error_code'] == "101"
4646
else:
4747
assert results['is_disposable'] == "True"
4848

49-
def testfreeemail(global_data):
50-
mbv = MailboxValidator.SingleValidation(global_data["apikey"])
51-
results = mbv.FreeEmail('example@example.com')
49+
def test_free_email(global_data):
50+
mbv = MailboxValidator.EmailValidation(global_data["apikey"])
51+
results = mbv.is_free_email('example@example.com')
5252
if (global_data["apikey"] == 'YOUR_API_KEY'):
5353
assert results['error_code'] == "101"
5454
else:

0 commit comments

Comments
 (0)