Compare commits

..

No commits in common. "f7dab77229dcc2da4534e00c13feefa851b830f1" and "4cd0635d5f55363620b21a8cb6b9d4a4915c0fe9" have entirely different histories.

3 changed files with 2 additions and 83 deletions

View File

@ -13,7 +13,6 @@ twine = "*"
pandoc = "*" pandoc = "*"
pylint-django = "*" pylint-django = "*"
setuptools = "*" setuptools = "*"
django-nose = "*"
[packages] [packages]
django = "*" django = "*"

View File

@ -49,15 +49,7 @@ INSTALLED_APPS = [
'django.contrib.contenttypes', 'django.contrib.contenttypes',
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles'
'django_nose'
]
TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'
NOSE_ARGS = [
'--with-coverage',
'--cover-package=lostplaces',
] ]
MIDDLEWARE = [ MIDDLEWARE = [

View File

@ -146,15 +146,6 @@ class TestPlaceListView(GlobalTemplateTestCaseMixin, ViewTestCase):
msg='Expecting the user to see it\'s own places' msg='Expecting the user to see it\'s own places'
) )
def test_eligible_to_see(self):
self.client.login(username='testpeter', password='Develop123')
response = self.client.get(reverse('place_list'))
self.assertTrue(
'Im a own place' in response.content.decode(),
msg='Expecting the user to see places where their level is high enough'
)
class TestPlaceCreateView(ViewTestCase): class TestPlaceCreateView(ViewTestCase):
view = PlaceCreateView view = PlaceCreateView
@ -372,8 +363,6 @@ class PlaceDetailViewTestCase(TaggableViewTestCaseMixin, MapableViewTestCaseMixi
username='testpeter', username='testpeter',
password='Develop123' password='Develop123'
) )
user.explorer.level = 3
user.explorer.save()
place = Place.objects.create( place = Place.objects.create(
name='Im a place', name='Im a place',
@ -382,72 +371,11 @@ class PlaceDetailViewTestCase(TaggableViewTestCaseMixin, MapableViewTestCaseMixi
location='Testtown', location='Testtown',
latitude=50.5, latitude=50.5,
longitude=7.0, longitude=7.0,
description='This is just a test, do not worry', description='This is just a test, do not worry'
level=3
) )
place.tags.add('I a tag', 'testlocation') place.tags.add('I a tag', 'testlocation')
place.save() place.save()
other_user = User.objects.create_user(
username='blubberbernd',
password='Develop123'
)
superuser = User.objects.create_user(
username='toor',
password='Develop123'
)
superuser.is_superuser = True
superuser.save()
Place.objects.create(
name='Im a own place',
submitted_when=timezone.now(),
submitted_by=other_user.explorer,
location='Test %d town' % 5,
latitude=50.5 + 5/10,
longitude=7.0 - 5/10,
description='This is just a test, do not worry %d' % 5,
level=3
)
def test_not_eligible_to_see_because_of_low_level(self):
self.client.login(username='blubberbernd', password='Develop123')
response = self.client.get(reverse('place_detail', kwargs={'pk': 1}))
self.assertFalse(
'Im a place' in response.content.decode(),
msg='Expecting the user to not see the places'
)
def test_not_eligible_to_see_because_of_low_level_superuser(self):
self.client.login(username='toor', password='Develop123')
response = self.client.get(reverse('place_detail', kwargs={'pk': 1}))
self.assertTrue(
'Im a place' in response.content.decode(),
msg='Expecting the superuser to see all places'
)
def test_not_eligible_to_see_because_of_low_level_own_place(self):
self.client.login(username='blubberbernd', password='Develop123')
response = self.client.get(reverse('place_detail', kwargs={'pk': 2}))
self.assertTrue(
'Im a own place' in response.content.decode(),
msg='Expecting the user to see it\'s own places'
)
def test_eligible_to_see(self):
self.client.login(username='testpeter', password='Develop123')
response = self.client.get(reverse('place_detail', kwargs={'pk': 2}))
self.assertTrue(
'Im a own place' in response.content.decode(),
msg='Expecting the user to see places where their level is high enough'
)
def test_not_authenticated(self): def test_not_authenticated(self):
response = self.client.get(reverse('place_detail', kwargs={'pk': 1})) response = self.client.get(reverse('place_detail', kwargs={'pk': 1}))
self.assertHttpRedirect(response) self.assertHttpRedirect(response)