Skip to content

Instantly share code, notes, and snippets.

@teward
Created March 24, 2017 21:51
Show Gist options
  • Save teward/c2e502482bda5946bf674c92ea0fd35b to your computer and use it in GitHub Desktop.
Save teward/c2e502482bda5946bf674c92ea0fd35b to your computer and use it in GitHub Desktop.
SmokeDetector AnswerTest Test Code for testing capture of known spam during migrations
#!/usr/bin/python
from spamhandling import check_if_spam
from classes import Post
# import json
if __name__ == "__main__":
# noinspection PyListCreation
POST_BODY = []
POST_BODY.append("<p>You can use allavsoft to download Movie Trailers Videos from Movieclips.</p>")
post_struct = {'title': '',
'body': "<p>You can use allavsoft to download Movie Trailers Videos from Movieclips.</p>",
'owner': {'display_name': "mediahumen", 'reputation': 1, 'link': ''},
'site': 'academia.stackexchange.com', 'IsAnswer': True, 'score': 0}
parent_ = Post(api_response={'title': 'Using movie clips in a conference presentation',
'body': "I'm a drafting a presentation for an upcoming conference. To illustrate "
"some points I'd like to include some clips from well-known scifi movies "
"about VR. Would this be considered \"fair use\"?\n\nCould said powerpoint "
"file be made available for download "
"(which would include the movie clips I guess) afterwards?'",
'owner': {'display_name': "TheWanderer", 'reputation': 707,
'link': 'http://academia.stackexchange.com/users/11338/thewanderer'},
'site': 'academia.stackexchange.com', 'IsAnswer': False, 'score': 20,
'answers': []})
post = Post(api_response=post_struct, parent=parent_)
is_spam, reason, why = check_if_spam(post=post)
print "\n\nIs Spam? %s\n" % bool(is_spam)
if is_spam:
print "Reason:\n%s\n" % reason
print "Why:\n%s\n" % why
exit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment