def populate_user(self):
     """Populates the current authenticated user from session state."""
     current_app.logger.info(
         "Method called, getting session user from session api")
     response = SessionAPIService.get_session_state(
         self.session_key, Session.session_user_key)
     if response is not None:
         current_app.logger.info("User data returned from session state")
         self.user = User.from_dict(response)
    def test_user_from_json(self):
        test = dict()
        test["id"] = 'id'
        test["first_name"] = "joe"
        test["surname"] = "bloggs"
        test["email"] = "testemail"
        test["organisation"] = "testorg"
        test["roles"] = ["testrole"]
        test["status"] = "Active"
        test["jwt"] = "MOCK.JWT"

        user = User.from_dict(test)

        self.assertEqual(user.id, 'id')
        self.assertEqual(user.first_name, "joe")
        self.assertEqual(user.surname, "bloggs")
        self.assertEqual(user.email, "testemail")
        self.assertEqual(user.organisation, "testorg")
        self.assertEqual(user.roles, ['testrole'])
        self.assertEqual(user.status, "Active")
        self.assertEqual(user.jwt, "MOCK.JWT")