Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 19:05:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 19:05:49 +0300
commit43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch)
treedceebdc68925362117480a5d672bcff122fb625b /spec/models/active_session_spec.rb
parent20c84b99005abd1c82101dfeff264ac50d2df211 (diff)
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'spec/models/active_session_spec.rb')
-rw-r--r--spec/models/active_session_spec.rb46
1 files changed, 27 insertions, 19 deletions
diff --git a/spec/models/active_session_spec.rb b/spec/models/active_session_spec.rb
index 3665f13015e..8717b2a1075 100644
--- a/spec/models/active_session_spec.rb
+++ b/spec/models/active_session_spec.rb
@@ -190,8 +190,7 @@ RSpec.describe ActiveSession, :clean_gitlab_redis_sessions do
Gitlab::Redis::Sessions.with do |redis|
expect(redis.scan_each.to_a).to include(
- described_class.key_name(user.id, session_id), # current session
- described_class.key_name_v1(user.id, session_id), # support for mixed deployment
+ described_class.key_name(user.id, session_id), # current session
lookup_key
)
end
@@ -217,19 +216,6 @@ RSpec.describe ActiveSession, :clean_gitlab_redis_sessions do
end
end
- it 'is possible to log in only using the old session key' do
- session_id = "2::418729c72310bbf349a032f0bb6e3fce9f5a69df8f000d8ae0ac5d159d8f21ae"
- ActiveSession.set(user, request)
-
- Gitlab::Redis::SharedState.with do |redis|
- redis.del(described_class.key_name(user.id, session_id))
- end
-
- sessions = ActiveSession.list(user)
-
- expect(sessions).to be_present
- end
-
it 'keeps the created_at from the login on consecutive requests' do
created_at = Time.zone.parse('2018-03-12 09:06')
updated_at = created_at + 1.minute
@@ -593,7 +579,7 @@ RSpec.describe ActiveSession, :clean_gitlab_redis_sessions do
let(:active_count) { 3 }
before do
- Gitlab::Redis::SharedState.with do |redis|
+ Gitlab::Redis::Sessions.with do |redis|
active_count.times do |number|
redis.set(
key_name(user.id, number),
@@ -608,13 +594,13 @@ RSpec.describe ActiveSession, :clean_gitlab_redis_sessions do
end
it 'removes obsolete lookup entries' do
- active = Gitlab::Redis::SharedState.with do |redis|
+ active = Gitlab::Redis::Sessions.with do |redis|
ActiveSession.cleaned_up_lookup_entries(redis, user)
end
expect(active.count).to eq(active_count)
- Gitlab::Redis::SharedState.with do |redis|
+ Gitlab::Redis::Sessions.with do |redis|
lookup_entries = redis.smembers(lookup_key)
expect(lookup_entries.count).to eq(active_count)
@@ -627,7 +613,7 @@ RSpec.describe ActiveSession, :clean_gitlab_redis_sessions do
it 'reports the removed entries' do
removed = []
- Gitlab::Redis::SharedState.with do |redis|
+ Gitlab::Redis::Sessions.with do |redis|
ActiveSession.cleaned_up_lookup_entries(redis, user, removed)
end
@@ -663,4 +649,26 @@ RSpec.describe ActiveSession, :clean_gitlab_redis_sessions do
it_behaves_like 'cleaning up lookup entries'
end
end
+
+ describe '.set_active_user_cookie' do
+ let(:auth) { double(cookies: {}) }
+
+ it 'sets marketing cookie' do
+ ActiveSession.set_active_user_cookie(auth)
+ expect(auth.cookies[:about_gitlab_active_user][:value]).to be_truthy
+ end
+ end
+
+ describe '.unset_active_user_cookie' do
+ let(:auth) { double(cookies: {}) }
+
+ before do
+ ActiveSession.set_active_user_cookie(auth)
+ end
+
+ it 'unsets marketing cookie' do
+ ActiveSession.unset_active_user_cookie(auth)
+ expect(auth.cookies[:about_gitlab_active_user]).to be_nil
+ end
+ end
end