Skip to content

Commit

Permalink
Apply coding style
Browse files Browse the repository at this point in the history
  • Loading branch information
Bouke committed Apr 16, 2017
1 parent 0321808 commit 06a20f2
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,23 @@ def test_delete(self):
args=[session_key]))
self.assertRedirects(response, '/')

def test_delete_other(self):
def test_delete_all_other(self):
self.user.session_set.create(ip='127.0.0.1', expire_date=datetime.now() + timedelta(days=1))
self.assertEqual(self.user.session_set.count(), 2)
response = self.client.post(reverse('user_sessions:session_delete_other'))
self.assertRedirects(response, reverse('user_sessions:session_list'))
self.assertEqual(self.user.session_set.count(), 1)

def test_delete_individual_other(self):
test_session_key = 'test'
expire_date = datetime.now() + timedelta(days=1)
self.user.session_set.create(session_key=test_session_key, ip='127.0.0.1', expire_date=expire_date)

def test_delete_some_other(self):
other = self.user.session_set.create(session_key='OTHER', ip='127.0.0.1',
expire_date=datetime.now() + timedelta(days=1))
self.assertEqual(self.user.session_set.count(), 2)
response = self.client.post(reverse('user_sessions:session_delete', args=[test_session_key]))
response = self.client.post(reverse('user_sessions:session_delete',
args=[other.session_key]))
self.assertRedirects(response, reverse('user_sessions:session_list'))
self.assertEqual(self.user.session_set.count(), 1)


class AdminTest(TestCase):
client_class = Client

Expand Down

0 comments on commit 06a20f2

Please sign in to comment.