2 # This file is part of my.gpodder.org.
4 # my.gpodder.org is free software: you can redistribute it and/or modify it
5 # under the terms of the GNU Affero General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or (at your
7 # option) any later version.
9 # my.gpodder.org is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
12 # License for more details.
14 # You should have received a copy of the GNU Affero General Public License
15 # along with my.gpodder.org. If not, see <http://www.gnu.org/licenses/>.
21 from django
.test
import TestCase
22 from django
.core
.urlresolvers
import reverse
24 import mygpo
.web
.utils
25 from mygpo
.users
.models
import User
26 from mygpo
.test
import create_auth_string
29 class SimpleWebTests(TestCase
):
33 self
.user
= User(username
='web-test', email
='web-test@example.com')
34 self
.user
.set_password('pwd')
37 self
.auth_string
= create_auth_string('test', 'pwd')
40 def tearDownClass(self
):
43 def test_access_parameterless_pages(self
):
50 'subscriptions-download',
64 self
.access_pages(pages
, [], True)
66 def test_access_podcast_pages(self
):
69 def access_pages(self
, pages
, args
, login
):
71 self
.client
.post('/login/', dict(
72 login_username
=self
.user
.username
, pwd
='pwd'))
75 response
= self
.client
.get(reverse(page
, args
=args
), follow
=True)
76 self
.assertEquals(response
.status_code
, 200)
80 suite
= unittest
.TestSuite()
81 suite
.addTest(doctest
.DocTestSuite(mygpo
.web
.utils
))
82 suite
.addTest(unittest
.TestLoader().loadTestsFromTestCase(SimpleWebTests
))