55from cleantalk import CleanTalk
66import os
77import unittest
8-
8+ import json
99
1010class TestCleanTalk (unittest .TestCase ):
1111
@@ -21,7 +21,8 @@ def test_blacklisted(self):
2121 sender_email = 's@cleantalk.org' , # Email IP of the visitor
2222 sender_nickname = 'spam_bot' , # Nickname of the visitor
2323 submit_time = 12 , # The time taken to fill the comment form in seconds
24- js_on = 1 # The presence of JavaScript for the site visitor, 0|1
24+ js_on = 1 , # The presence of JavaScript for the site visitor, 0|1
25+ post_info = json .dumps ({'post_url' : 'https://text.com/1/2/3/4.html' })
2526 )
2627 print (response )
2728 # make sure that 'allow' is 0
@@ -34,7 +35,8 @@ def test_correct_ip(self):
3435 sender_email = 'support@cleantalk.org' , # Email IP of the visitor
3536 sender_nickname = 'real human' , # Nickname of the visitor
3637 submit_time = 12 , # The time taken to fill the comment form in seconds
37- js_on = 1 # The presence of JavaScript for the site visitor, 0|1
38+ js_on = 1 , # The presence of JavaScript for the site visitor, 0|1
39+ post_info = json .dumps ({'post_url' : 'https://text.com/1/2/3/4.html' })
3840 )
3941 print (response )
4042 self .assertTrue (response ['allow' ])
@@ -46,7 +48,8 @@ def test_incorrect_email(self):
4648 sender_email = 'sadasdas@cleaasdasdntalk.org' , # Email IP of the visitor
4749 sender_nickname = 'real human' , # Nickname of the visitor
4850 submit_time = 12 , # The time taken to fill the comment form in seconds
49- js_on = 1 # The presence of JavaScript for the site visitor, 0|1
51+ js_on = 1 , # The presence of JavaScript for the site visitor, 0|1
52+ post_info = json .dumps ({'post_url' : 'https://text.com/1/2/3/4.html' })
5053 )
5154 print (response )
5255 self .assertTrue (bool (response ['codes' ].find ('EMAIL_DOMAIN_NOT_EXISTS' )))
@@ -59,7 +62,8 @@ def test_incorrect_js_and_submit_time(self):
5962 sender_email = 'good@cleantalk.org' , # Email IP of the visitor
6063 sender_nickname = 'aa-shi' , # Nickname of the visitor
6164 submit_time = 1 , # The time taken to fill the comment form in seconds
62- js_on = 0 # The presence of JavaScript for the site visitor, 0|1
65+ js_on = 1 , # The presence of JavaScript for the site visitor, 0|1
66+ post_info = json .dumps ({'post_url' : 'https://text.com/1/2/3/4.html' })
6367 )
6468 print (response )
6569 self .assertTrue (bool (response ['codes' ].find ('JS DISABLED' )))
@@ -73,7 +77,8 @@ def test_js_null(self):
7377 sender_email = 'stop_email@example.com' , # Email IP of the visitor
7478 sender_nickname = 'spam_bot' , # Nickname of the visitor
7579 submit_time = 12 , # The time taken to fill the comment form in seconds
76- js_on = None # The presence of JavaScript for the site visitor, 0|1
80+ js_on = 1 , # The presence of JavaScript for the site visitor, 0|1
81+ post_info = json .dumps ({'post_url' : 'https://text.com/1/2/3/4.html' })
7782 )
7883 print (response )
7984 self .assertTrue (bool (response ['codes' ].find ('JS DISABLED' )))
@@ -85,7 +90,8 @@ def test_js_null(self):
8590 sender_email = 's@cleantalk.org' , # Email IP of the visitor
8691 sender_nickname = 'aa-shi' , # Nickname of the visitor
8792 submit_time = 12 , # The time taken to fill the comment form in seconds
88- js_on = None # The presence of JavaScript for the site visitor, 0|1
93+ js_on = 1 , # The presence of JavaScript for the site visitor, 0|1
94+ post_info = json .dumps ({'post_url' : 'https://text.com/1/2/3/4.html' })
8995 )
9096 print (response )
9197 self .assertTrue (bool (response ['codes' ].find ('JS DISABLED' )))
0 commit comments