예제 #1
0
    def test_create_user_update_password(self):
        scenario = basic.CreateUserUpdatePassword(self.context)
        fake_password = "******"
        fake_user = mock.MagicMock()
        scenario._user_create = mock.MagicMock(return_value=fake_user)
        scenario.generate_random_name = mock.MagicMock(
            return_value=fake_password)
        scenario._update_user_password = mock.MagicMock()

        scenario.run()
        scenario.generate_random_name.assert_called_once_with()
        scenario._user_create.assert_called_once_with()
        scenario._update_user_password.assert_called_once_with(
            fake_user.id, fake_password)
예제 #2
0
    def test_create_user_update_password(self):
        identity_service = self.mock_identity.return_value

        scenario = basic.CreateUserUpdatePassword(self.context)

        fake_password = "******"
        fake_user = identity_service.create_user.return_value
        scenario.generate_random_name = mock.MagicMock(
            return_value=fake_password)

        scenario.run()

        scenario.generate_random_name.assert_called_once_with()
        identity_service.create_user.assert_called_once_with()
        identity_service.update_user.assert_called_once_with(
            fake_user.id, password=fake_password)