Example #1
0
 def test_successful_change_settings(self) -> None:
     """
     A call to /json/settings with valid parameters changes the user's
     settings correctly and returns correct values.
     """
     self.login(self.example_email("hamlet"))
     json_result = self.client_patch(
         "/json/settings",
         dict(
             full_name='Foo Bar',
             old_password=initial_password(self.example_email("hamlet")),
             new_password='******',
         ))
     self.assert_json_success(json_result)
     result = ujson.loads(json_result.content)
     self.check_well_formed_change_settings_response(result)
     self.assertEqual(self.example_user('hamlet').full_name, "Foo Bar")
     self.logout()
     self.login(self.example_email("hamlet"), "foobar1")
     user_profile = self.example_user('hamlet')
     self.assertEqual(get_session_dict_user(self.client.session),
                      user_profile.id)
Example #2
0
 def test_successful_change_settings(self) -> None:
     """
     A call to /json/settings with valid parameters changes the user's
     settings correctly and returns correct values.
     """
     self.login(self.example_email("hamlet"))
     json_result = self.client_patch(
         "/json/settings",
         dict(
             full_name='Foo Bar',
             old_password=initial_password(self.example_email("hamlet")),
             new_password='******',
         ))
     self.assert_json_success(json_result)
     result = ujson.loads(json_result.content)
     self.check_well_formed_change_settings_response(result)
     self.assertEqual(self.example_user('hamlet').
                      full_name, "Foo Bar")
     self.logout()
     self.login(self.example_email("hamlet"), "foobar1")
     user_profile = self.example_user('hamlet')
     self.assertEqual(get_session_dict_user(self.client.session), user_profile.id)
Example #3
0
 def assert_logged_in_user_id(self, user_id: Optional[int]) -> None:
     """
     Verifies the user currently logged in for the test client has the provided user_id.
     Pass None to verify no user is logged in.
     """
     self.assertEqual(get_session_dict_user(self.client.session), user_id)