-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TASK: Add first tests for Paste class
I should do some testing (#11). This is the start of adding testing to the project
- Loading branch information
1 parent
5e374f5
commit 5567c28
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import unittest | ||
|
||
from pastepwn import Paste | ||
|
||
|
||
class PasteTest(unittest.TestCase): | ||
|
||
def setUp(self): | ||
p = {"scrape_url": "https://scrape.pastebin.com/api_scrape_item.php?i=0CeaNm8Y", | ||
"full_url": "https://pastebin.com/0CeaNm8Y", | ||
"date": "1442911802", | ||
"key": "0CeaNm8Y", | ||
"size": "890", | ||
"expire": "1442998159", | ||
"title": "Once we all know when we goto function", | ||
"syntax": "java", | ||
"user": "admin", | ||
"body": "this is a test paste"} | ||
|
||
self.p = p | ||
self.paste = Paste(p.get("key"), | ||
p.get("title"), | ||
p.get("user"), | ||
p.get("size"), | ||
p.get("date"), | ||
p.get("expire"), | ||
p.get("syntax"), | ||
p.get("scrape_url"), | ||
p.get("full_url")) | ||
|
||
def tearDown(self): | ||
pass | ||
|
||
def test_init_paste(self): | ||
self.assertEqual(self.p.get("key"), self.paste.key) | ||
self.assertEqual(self.p.get("title"), self.paste.title) | ||
self.assertEqual(self.p.get("user"), self.paste.user) | ||
self.assertEqual(self.p.get("size"), self.paste.size) | ||
self.assertEqual(self.p.get("date"), self.paste.date) | ||
self.assertEqual(self.p.get("expire"), self.paste.expire) | ||
self.assertEqual(self.p.get("syntax"), self.paste.syntax) | ||
self.assertEqual(self.p.get("scrape_url"), self.paste.scrape_url) | ||
self.assertEqual(self.p.get("full_url"), self.paste.full_url) | ||
self.assertEqual(None, self.paste.body) | ||
|
||
def test_set_body(self): | ||
my_body = "This is a test for pastepwn" | ||
self.paste.set_body(my_body) | ||
self.assertEqual(my_body, self.paste.body) |