diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/sessions_tests/tests.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/sessions_tests/tests.py b/tests/sessions_tests/tests.py index 81c2e7a5de..f23fa9778d 100644 --- a/tests/sessions_tests/tests.py +++ b/tests/sessions_tests/tests.py @@ -1373,3 +1373,14 @@ class SessionBaseTests(SimpleTestCase): def test_is_empty(self): self.assertIs(self.session.is_empty(), True) + + def test_bool(self): + # Empty session is falsy + self.assertIs(bool(self.session), False) + # Session with data is truthy + self.session["foo"] = "bar" + self.assertIs(bool(self.session), True) + # Session with key but no data is truthy + session_with_key = SessionBase() + session_with_key._session_key = "testkey1234" + self.assertIs(bool(session_with_key), True) |
