Skip to content

Commit

Permalink
Fix user test
Browse files Browse the repository at this point in the history
  • Loading branch information
nirinchev committed Apr 26, 2024
1 parent cd6e4eb commit 187559d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 1 addition & 4 deletions Tests/Realm.Tests/Sync/UserManagementTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,10 +374,7 @@ public void User_LinkCredentials_WhenAnonymous_Throws()
var user = await GetUserAsync();
var ex = await TestHelpers.AssertThrows<AppException>(() => user.LinkCredentialsAsync(Credentials.Anonymous()));
// TODO: this should be bad request when https://jira.mongodb.org/browse/REALMC-7028 is fixed
Assert.That(ex.StatusCode, Is.EqualTo(HttpStatusCode.InternalServerError));
Assert.That(ex.Message, Does.Contain("linking an anonymous identity is not allowed"));
Assert.That(ex.Message, Does.Contain("Cannot add anonymous credentials to an existing user"));
});
}

Expand Down
5 changes: 3 additions & 2 deletions wrappers/src/sync_session_cs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <realm/object-store/sync/sync_session.hpp>
#include "sync_session_cs.hpp"
#include <realm/sync/client_base.hpp>
#include <realm/object-store/sync/app_user.hpp>

namespace realm::binding {
enum class NotifiableProperty : uint8_t {
Expand All @@ -43,13 +44,13 @@ std::function<NotifyBeforeClientResetCallbackT> s_notify_before_callback;
std::function<NotifyAfterClientResetCallbackT> s_notify_after_callback;

extern "C" {
REALM_EXPORT std::shared_ptr<SyncUser>* realm_syncsession_get_user(const SharedSyncSession& session)
REALM_EXPORT std::shared_ptr<app::User>* realm_syncsession_get_user(const SharedSyncSession& session)
{
if (session->user() == nullptr) {
return nullptr;
}

return new std::shared_ptr<SyncUser>(session->user());
return new std::shared_ptr<app::User>(std::dynamic_pointer_cast<app::User>(session->user()));
}

enum class CSharpSessionState : uint8_t {
Expand Down

0 comments on commit 187559d

Please sign in to comment.