-
-
Notifications
You must be signed in to change notification settings - Fork 555
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from KingAkeem/dev
Switched testing framework from unittest to pytest
- Loading branch information
Showing
4 changed files
with
21 additions
and
80 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,37 +1,21 @@ | ||
#!/usr/bin/env python | ||
|
||
import unittest | ||
import sys | ||
import os | ||
PACKAGE_PARENT = '..' | ||
SCRIPT_DIR = os.path.dirname(os.path.realpath( | ||
os.path.join(os.getcwd(), os.path.expanduser(__file__)))) | ||
|
||
sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT))) | ||
from io import StringIO | ||
from modules.bcolors import Bcolors | ||
from modules import getweblinks, pagereader | ||
|
||
soup = pagereader.readPage('http://www.whatsmyip.net/') | ||
|
||
def test_get_links_successful(): | ||
soup = pagereader.readPage('http://www.whatsmyip.net/') | ||
data = ['http://aff.ironsocket.com/SH7L', | ||
'http://aff.ironsocket.com/SH7L', | ||
'http://wsrs.net/', | ||
'http://cmsgear.com/'] | ||
|
||
class getLinksTestCase(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.b_colors = Bcolors() | ||
self.held, sys.stdout = sys.stdout, StringIO() | ||
self.maxDiff = None | ||
|
||
def test_get_links(self): | ||
|
||
data = ['http://aff.ironsocket.com/SH7L', | ||
'http://aff.ironsocket.com/SH7L', | ||
'http://wsrs.net/', | ||
'http://cmsgear.com/'] | ||
|
||
result = getweblinks.getLinks(soup) | ||
self.assertEqual(result, data) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() | ||
result = getweblinks.getLinks(soup) | ||
assert result == data |
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 |
---|---|---|
@@ -1,36 +1,19 @@ | ||
import sys | ||
import os | ||
import unittest | ||
import time | ||
PACKAGE_PARENT = '..' | ||
SCRIPT_DIR = os.path.dirname(os.path.realpath( | ||
os.path.join(os.getcwd(), os.path.expanduser(__file__)))) | ||
|
||
sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT))) | ||
|
||
from io import StringIO | ||
from modules.bcolors import Bcolors | ||
from modules import getweblinks, pagereader | ||
|
||
soup = pagereader.readPage('http://www.whatsmyip.net/') | ||
timestr = time.strftime("%Y%m%d-%H%M%S") | ||
|
||
|
||
class getLinksTestCase(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.held, sys.stdout = sys.stdout, StringIO() | ||
self.maxDiff = None | ||
self.b_colors = Bcolors() | ||
|
||
def test_save_links(self): | ||
data = ['http://aff.ironsocket.com/SH7L', | ||
'http://aff.ironsocket.com/SH7L', | ||
'http://wsrs.net/', | ||
'http://cmsgear.com/'] | ||
result = getweblinks.getLinks(soup) | ||
self.assertEqual(result, data) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() | ||
def test_save_links_successful(): | ||
soup = pagereader.readPage('http://www.whatsmyip.net/') | ||
data = ['http://aff.ironsocket.com/SH7L', | ||
'http://aff.ironsocket.com/SH7L', | ||
'http://wsrs.net/', | ||
'http://cmsgear.com/'] | ||
result = getweblinks.getLinks(soup) | ||
assert result == data |