def test_with_user(self): test_user = User.objects.create_user( 'testuser', '*****@*****.**', token='bla') url = tags.ontherunurl({'request': self._create_request()}, user=test_user) self.assertTrue(url.endswith(reverse( 'ontherun', kwargs={'username': '******', 'token': 'bla'})))
def test_with_user(self): test_user = User.objects.create_user('testuser', '*****@*****.**', token='bla') url = tags.ontherunurl({'request': self._create_request()}, user=test_user) self.assertTrue( url.endswith( reverse('ontherun', kwargs={ 'username': '******', 'token': 'bla' })))
def test_profileuser_with_request(self): testuser = User.objects.create(username='******', token='bla') url = tags.ontherunurl({'request': self._create_request(), 'profileuser': testuser}) self.assertTrue(url.endswith(reverse( 'ontherun', kwargs={'username': '******', 'token': 'bla'})))
def test_profileuser_without_request(self): testuser = User.objects.create(username='******') with self.assertRaises(KeyError): tags.ontherunurl({'profileuser': testuser})
def test_no_user(self): with self.assertRaises(KeyError): tags.ontherunurl({})
def test_profileuser_without_request(self): test_user = User.objects.create_user('testuser', '*****@*****.**') with self.assertRaises(KeyError): tags.ontherunurl({'profileuser': test_user})