Total Complexity | 7 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | import unittest |
||
9 | class TestSmartPrice(unittest.TestCase): |
||
10 | |||
11 | def setUp(self): |
||
12 | self.smartprice = SmartPrice() |
||
13 | # self.generate_soupelement_tests() |
||
14 | |||
15 | def generate_soupelement_tests(self): |
||
16 | """Generate test methods to check valid URLS""" |
||
17 | for key, url in constants.URL_MAPPER.iteritems(): |
||
18 | testmethodname = 'test_fn_{0}'.format(key) |
||
19 | testmethod = lambda self: self.assertEqual(key, key) |
||
20 | setattr(TestSmartPrice, testmethodname, testmethod) |
||
21 | |||
22 | def test_webexists(self): |
||
23 | self.assertEqual( |
||
24 | 'http://www.mysmartprice.com/', |
||
25 | constants.SMARTPRICE_WEB_URL |
||
26 | ) |
||
27 | |||
28 | def test_validurls(self): |
||
29 | for key, url in constants.URL_MAPPER.iteritems(): |
||
30 | complete_url = '{}{}'.format(constants.SMARTPRICE_WEB_URL, url) |
||
31 | requests.get(complete_url) |
||
32 |