def test_id_from_session(self):
            # With real session
            with self.web_user(AnonymousUser()) as experiment_user:
                self.mox.ReplayAll()
                session = experiment_user.session
                self.assertEqual(
                    self.analytics._id_from_session(experiment_user.session),
                    'Session %s' % session.session_key
                )
                self.mox.VerifyAll()

            # With dict as session
            experiment_user = StaticUser()
            self.assertRaises(IdentificationError,
                              self.analytics._id_from_session,
                              experiment_user.session)
dataset/ETHPy150Open e-loue/django-lean/django_lean/lean_analytics/tests.py/TestKissMetrics.test_id_from_session/original