Back
Oct 11, 2010

Testing authentication in Django

Vladimir Sidorenko
Vladimir Sidorenko

In order to check if user is authentcated in test, you can run:

from django.contrib.auth import get_user

  class MyTestCase(TestCase):
      def test_login(self):
          self.assertFalse(get_user(self.client).is_authenticated())
          self.client.login(username='fred', password='secret')
          self.assertTrue(get_user(self.client).is_authenticated())

More thoughts

Jan 22, 2017Technology
Django vs Rails Performance

This article is aimed for beginners, who are trying to choose between Ruby on Rails and Django. Let’s see which is fastest and why.

Vladimir Sidorenko
Vladimir Sidorenko
Dec 1, 2016Technology
How to Use Django & PostgreSQL for Full Text Search

For any project there may be a need to use a database full-text search. We expect high speed and relevant results from this search. When we face such problem, we usually think about Solr, ElasticSearch, Sphinx, AWS CloudSearch, etc. But in this article we will talk about PostgreSQL. Starting from version 8.3, a full-text search support in PostgreSQL is available. Let's look at how it is implemented in the DBMS itself.

Vladimir Kalyuzhny
Vladimir Kalyuzhny
Oct 3, 2016Technology
How to include JQuery plugins in Angular 2 running via webpack

Learn more about how to include jquery plugins in angular 2 running via webpack. Our tutorial is perfect for Angular beginners.

Anton Lysenkov
Anton Lysenkov
Jan 9, 2017Technology
How to Use GraphQL with Django

GraphQL is a very powerful library, which is not difficult to understand. GraphQL will help to write simple and clear REST API to suit every taste and meet any requirements.

Rostyslav Stekh
Rostyslav Stekh