5
5
6
6
import MailboxValidator
7
7
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" ])
10
10
results = mbv .ValidateEmail ('example@example.com' )
11
11
assert results ['error_message' ] == 'API key not found.'
12
12
13
- def testapikeyexist (global_data , capsys ):
13
+ def test_api_key_exist (global_data , capsys ):
14
14
if (global_data ["apikey" ] == 'YOUR_API_KEY' ):
15
15
with capsys .disabled ():
16
16
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):
19
19
else :
20
20
assert global_data ["apikey" ] != "YOUR_API_KEY"
21
21
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" ])
24
24
errors = []
25
- functions_list = ['ValidateEmail ' , 'DisposableEmail ' , 'FreeEmail ' ]
25
+ functions_list = ['validate_email ' , 'is_disposable_email ' , 'is_free_email ' ]
26
26
for x in range (len (functions_list )):
27
27
# 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 ):
29
29
errors .append ("Function " + functions_list [x ] + " did not exist." )
30
30
# assert no error message has been registered, else print messages
31
31
assert not errors , "errors occured:\n {}" .format ("\n " .join (errors ))
32
32
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' )
36
36
if (global_data ["apikey" ] == 'YOUR_API_KEY' ):
37
37
assert results ['error_code' ] == "101"
38
38
else :
39
39
assert results ['status' ] == "False"
40
40
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' )
44
44
if (global_data ["apikey" ] == 'YOUR_API_KEY' ):
45
45
assert results ['error_code' ] == "101"
46
46
else :
47
47
assert results ['is_disposable' ] == "True"
48
48
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' )
52
52
if (global_data ["apikey" ] == 'YOUR_API_KEY' ):
53
53
assert results ['error_code' ] == "101"
54
54
else :
0 commit comments