From 27f19f618a548973271ba8b873a4c1ef16e4fe59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Slez=C3=A1k?= Date: Thu, 14 Nov 2024 17:35:26 +0100 Subject: [PATCH] Update unit tests --- service/test/agama/dbus/users_test.rb | 4 ++-- service/test/agama/users_test.rb | 18 +++++++++--------- .../users/RootPasswordPopup.test.jsx | 5 ++++- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/service/test/agama/dbus/users_test.rb b/service/test/agama/dbus/users_test.rb index 744d6cb7db..2d1617f912 100644 --- a/service/test/agama/dbus/users_test.rb +++ b/service/test/agama/dbus/users_test.rb @@ -69,7 +69,7 @@ let(:user) { nil } it "returns default data" do - expect(subject.first_user).to eq(["", "", "", false, {}]) + expect(subject.first_user).to eq(["", "", "", false, false, {}]) end end @@ -86,7 +86,7 @@ end it "returns the first user data" do - expect(subject.first_user).to eq(["Test user", "test", "12345", true, {}]) + expect(subject.first_user).to eq(["Test user", "test", "12345", false, true, {}]) end end end diff --git a/service/test/agama/users_test.rb b/service/test/agama/users_test.rb index 28808cefa4..47c46c68a4 100644 --- a/service/test/agama/users_test.rb +++ b/service/test/agama/users_test.rb @@ -81,7 +81,7 @@ describe "#assign_first_user" do context "when the options given do not present any issue" do it "adds the user to the user's configuration" do - subject.assign_first_user("Jane Doe", "jane", "12345", false, {}) + subject.assign_first_user("Jane Doe", "jane", "12345", false, false, {}) user = users_config.users.by_name("jane") expect(user.full_name).to eq("Jane Doe") expect(user.password).to eq(Y2Users::Password.create_plain("12345")) @@ -89,11 +89,11 @@ context "when a first user exists" do before do - subject.assign_first_user("Jane Doe", "jane", "12345", false, {}) + subject.assign_first_user("Jane Doe", "jane", "12345", false, false, {}) end it "replaces the user with the new one" do - subject.assign_first_user("John Doe", "john", "12345", false, {}) + subject.assign_first_user("John Doe", "john", "12345", false, false, {}) user = users_config.users.by_name("jane") expect(user).to be_nil @@ -104,23 +104,23 @@ end it "returns an empty array of issues" do - issues = subject.assign_first_user("Jane Doe", "jane", "12345", false, {}) + issues = subject.assign_first_user("Jane Doe", "jane", "12345", false, false, {}) expect(issues).to be_empty end end context "when the given arguments presents some critical error" do it "does not add the user to the config" do - subject.assign_first_user("Jonh Doe", "john", "", false, {}) + subject.assign_first_user("Jonh Doe", "john", "", false, false, {}) user = users_config.users.by_name("john") expect(user).to be_nil - subject.assign_first_user("Ldap user", "ldap", "12345", false, {}) + subject.assign_first_user("Ldap user", "ldap", "12345", false, false, {}) user = users_config.users.by_name("ldap") expect(user).to be_nil end it "returns an array with all the issues" do - issues = subject.assign_first_user("Root user", "root", "12345", false, {}) + issues = subject.assign_first_user("Root user", "root", "12345", false, false, {}) expect(issues.size).to eql(1) end end @@ -128,7 +128,7 @@ describe "#remove_first_user" do before do - subject.assign_first_user("Jane Doe", "jane", "12345", false, {}) + subject.assign_first_user("Jane Doe", "jane", "12345", false, false, {}) end it "removes the already defined first user" do @@ -196,7 +196,7 @@ context "when a first user is defined" do before do - subject.assign_first_user("Jane Doe", "jdoe", "123456", false, {}) + subject.assign_first_user("Jane Doe", "jdoe", "123456", false, false, {}) end it "returns an empty list" do diff --git a/web/src/components/users/RootPasswordPopup.test.jsx b/web/src/components/users/RootPasswordPopup.test.jsx index f6ddd724dc..0624a56161 100644 --- a/web/src/components/users/RootPasswordPopup.test.jsx +++ b/web/src/components/users/RootPasswordPopup.test.jsx @@ -75,7 +75,10 @@ describe("when it is open", () => { expect(confirmButton).toBeEnabled(); await user.click(confirmButton); - expect(mockRootUserMutation.mutateAsync).toHaveBeenCalledWith({ password }); + expect(mockRootUserMutation.mutateAsync).toHaveBeenCalledWith({ + password, + passwordEncrypted: false, + }); expect(onCloseCallback).toHaveBeenCalled(); });