Skip to content

Commit

Permalink
Prepare for 12.2.0 (#3608)
Browse files Browse the repository at this point in the history
* Prepare for 12.2.0

* Fix some auth tests

---------

Co-authored-by: nirinchev <nirinchev@users.noreply.github.com>
Co-authored-by: Nikola Irinchev <irinchev@me.com>
  • Loading branch information
3 people authored May 22, 2024
1 parent f30ffdf commit f05a3cf
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## vNext (TBD)
## 12.2.0 (2024-05-22)

### Enhancements
* Added support for `Migration.FindInNewRealm` which is a helper that allows you to lookup the object in the post-migration Realm that corresponds to an object from the pre-migration Realm. (Issue [#3600](https://github.com/realm/realm-dotnet/issues/3600))
Expand Down
2 changes: 1 addition & 1 deletion Realm/AssemblyInfo.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Product Condition="'$(Product)' == ''">Realm .NET</Product>
<VersionPrefix>12.1.0</VersionPrefix>
<VersionPrefix>12.2.0</VersionPrefix>
<Description Condition="'$(Description)' == ''">Realm is a mobile database: a replacement for SQLite</Description>
<Company>Realm Inc.</Company>
<Copyright>Copyright © $([System.DateTime]::Now.ToString(yyyy)) Realm Inc.</Copyright>
Expand Down
2 changes: 1 addition & 1 deletion Realm/Realm.Unity/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "io.realm.unity",
"version": "12.1.0",
"version": "12.2.0",
"displayName": "Realm",
"description": "Realm is an embedded, object-oriented database that lets you build real-time, always-on applications. With Realm, data is directly exposed as objects and queryable by code, removing the need for ORM's riddled with performance & maintenance issues. Additionally, objects and collections in Realm are always live, meaning that they always reflect the latest data stored in the database. You can subscribe to changes, letting you keep your UI consistently up to date.\nThe .NET Realm SDK also provide access to Atlas App Services, a secure backend that can sync data between devices, authenticate and manage users, and run serverless JavaScript functions.",
"unity": "2021.1",
Expand Down
20 changes: 10 additions & 10 deletions Tests/Realm.Tests/Sync/UserManagementTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public void AppDeleteUserFromServer_RemovesUser()
Assert.That(DefaultApp.CurrentUser, Is.Null);

var ex = await TestHelpers.AssertThrows<AppException>(() => DefaultApp.LogInAsync(Credentials.EmailPassword(username, password)));
Assert.That(ex.Message, Is.EqualTo("InvalidPassword: invalid username/password"));
Assert.That(ex.Message, Is.EqualTo("InvalidPassword: unauthorized"));
});
}

Expand Down Expand Up @@ -362,7 +362,7 @@ public void User_LinkCredentials_WhenMultipleEmailPassword_Throws()

// 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 a local-userpass identity is not allowed when one is already linked"));
Assert.That(ex.Message, Does.Contain("unauthorized"));
});
}

Expand All @@ -385,14 +385,14 @@ public void User_LinkCredentials_WhenInUse_Throws()
{
var existingEmail = SyncTestHelpers.GetVerifiedUsername();
await DefaultApp.EmailPasswordAuth.RegisterUserAsync(existingEmail, SyncTestHelpers.DefaultPassword);
var emailUser = await DefaultApp.LogInAsync(Credentials.EmailPassword(existingEmail, SyncTestHelpers.DefaultPassword));
await DefaultApp.LogInAsync(Credentials.EmailPassword(existingEmail, SyncTestHelpers.DefaultPassword));

var anonUser = await DefaultApp.LogInAsync(Credentials.Anonymous());

var ex = await TestHelpers.AssertThrows<AppException>(() => anonUser.LinkCredentialsAsync(Credentials.EmailPassword(existingEmail, SyncTestHelpers.DefaultPassword)));

Assert.That(ex.StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized));
Assert.That(ex.Message, Does.Contain("a user already exists with the specified provider"));
Assert.That(ex.Message, Does.Contain("unauthorized"));
});
}

Expand All @@ -410,7 +410,7 @@ public void User_RetryCustomConfirmationAsync_RerunsConfirmation()
await DefaultApp.EmailPasswordAuth.RegisterUserAsync(unconfirmedMail, SyncTestHelpers.DefaultPassword).Timeout(10_000, detail: "Failed to register user");

var ex3 = await TestHelpers.AssertThrows<AppException>(() => DefaultApp.LogInAsync(credentials));
Assert.That(ex3.Message, Does.Contain("confirmation required"));
Assert.That(ex3.Message, Does.Contain("AuthError: unauthorized"));

// The second time we call the confirmation function we find the email we saved in the collection and return "success", so the user
// gets confirmed and can log in.
Expand Down Expand Up @@ -445,7 +445,7 @@ public void User_ConfirmUserAsync_ConfirmsUser()
await DefaultApp.EmailPasswordAuth.RegisterUserAsync(unconfirmedMail, SyncTestHelpers.DefaultPassword).Timeout(10_000, detail: "Failed to register user");

var ex = await TestHelpers.AssertThrows<AppException>(() => DefaultApp.LogInAsync(credentials));
Assert.That(ex.Message, Does.Contain("confirmation required"));
Assert.That(ex.Message, Does.Contain("AuthError: unauthorized"));

// This retrieves the token and tokenId we saved in the confirmation function
var functionUser = await GetUserAsync();
Expand Down Expand Up @@ -495,7 +495,7 @@ public void User_ResetPasswordAsync_ConfirmsResetPassword()
await DefaultApp.EmailPasswordAuth.CallResetPasswordFunctionAsync(email, newPassword);

var ex = await TestHelpers.AssertThrows<AppException>(() => DefaultApp.LogInAsync(Credentials.EmailPassword(email, newPassword)));
Assert.That(ex.Message, Does.Contain("invalid username/password"));
Assert.That(ex.Message, Does.Contain("InvalidPassword: unauthorized"));

// This retrieves the token and tokenId we saved in the password reset function.
var functionUser = await GetUserAsync();
Expand Down Expand Up @@ -886,7 +886,7 @@ public void UserApiKeys_CanLoginWithReenabledKey()
var ex = await TestHelpers.AssertThrows<AppException>(() => DefaultApp.LogInAsync(credentials));
Assert.That(ex.StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized));
Assert.That(ex.HelpLink, Does.Contain("logs?co_id="));
Assert.That(ex.Message, Is.EqualTo("AuthError: invalid API key"));
Assert.That(ex.Message, Is.EqualTo("AuthError: unauthorized"));

await user.ApiKeys.EnableAsync(apiKey.Id);

Expand All @@ -913,7 +913,7 @@ public void UserApiKeys_CantLoginWithDisabledKey()
var ex = await TestHelpers.AssertThrows<AppException>(() => DefaultApp.LogInAsync(credentials));

Assert.That(ex.StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized));
Assert.That(ex.Message, Is.EqualTo("AuthError: invalid API key"));
Assert.That(ex.Message, Is.EqualTo("AuthError: unauthorized"));
Assert.That(ex.HelpLink, Does.Contain("logs?co_id="));
});
}
Expand All @@ -933,7 +933,7 @@ public void UserApiKeys_CantLoginWithDeletedKey()
var ex = await TestHelpers.AssertThrows<AppException>(() => DefaultApp.LogInAsync(credentials));

Assert.That(ex.StatusCode, Is.EqualTo(HttpStatusCode.Unauthorized));
Assert.That(ex.Message, Is.EqualTo("AuthError: invalid API key"));
Assert.That(ex.Message, Is.EqualTo("AuthError: unauthorized"));
Assert.That(ex.HelpLink, Does.Contain("logs?co_id="));
});
}
Expand Down

0 comments on commit f05a3cf

Please sign in to comment.