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

Jun 27, 2018Technology
How to Work With Legacy Code: Code Refactoring Techniques

In this article we'll review general approach to working with the best kind of projects - the ones with old untested and undocumented spaghetti code and a tight schedule. We'll review anger management techniques, coping mechanisms and some refactoring tips that might come in handy.

Vladimir Sidorenko
Vladimir Sidorenko
Dec 11, 2016Technology
Auto WebSocket Reconnection with RxJS (with Example)

In this RxJS tutorial article, we will focus on restoring the websocket connection when using RxJS library.

Igor Tokarev
Igor Tokarev
Feb 18, 2010Technology
Business logic in models

In my recent project there was a lot of data business logic, so I had to organize this code somehow. In this article I'll describe a few hints on how to it.

Vladimir Sidorenko
Vladimir Sidorenko
Aug 27, 2020Technology
5 tips for designing database architecture

Designing database architecture is a challenging task, and it gets even more difficult when your app keeps getting bigger. Here are several tips on how to manage your data structure in a more efficient way.

Yurii Mironov
Yurii Mironov