Remove rs namespace from Redis keys
Superfluous, since the whole db should be RS only
This commit is contained in:
parent
56c127ca0c
commit
92310d434a
@ -29,7 +29,7 @@ class RemoteStorageAuthorization < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def delete_token_from_redis
|
def delete_token_from_redis
|
||||||
key = "rs:authorizations:#{user.address}:#{token}"
|
key = "authorizations:#{user.cn}:#{token}"
|
||||||
redis.srem? key, redis.smembers(key)
|
redis.srem? key, redis.smembers(key)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ class RemoteStorageAuthorization < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def store_token_in_redis
|
def store_token_in_redis
|
||||||
redis.sadd "rs:authorizations:#{user.address}:#{token}", permissions
|
redis.sadd "authorizations:#{user.cn}:#{token}", permissions
|
||||||
end
|
end
|
||||||
|
|
||||||
def schedule_token_expiry
|
def schedule_token_expiry
|
||||||
|
@ -20,7 +20,7 @@ RSpec.describe RemoteStorageExpireAuthorizationJob, type: :job do
|
|||||||
}
|
}
|
||||||
|
|
||||||
it "removes the RS authorization from redis" do
|
it "removes the RS authorization from redis" do
|
||||||
redis_key = "rs:authorizations:#{@user.address}:#{@rs_authorization.token}"
|
redis_key = "authorizations:#{@user.cn}:#{@rs_authorization.token}"
|
||||||
expect(redis.keys(redis_key)).to_not be_empty
|
expect(redis.keys(redis_key)).to_not be_empty
|
||||||
|
|
||||||
perform_enqueued_jobs { job }
|
perform_enqueued_jobs { job }
|
||||||
|
@ -7,7 +7,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
|||||||
|
|
||||||
describe "#create" do
|
describe "#create" do
|
||||||
after(:each) { clear_enqueued_jobs }
|
after(:each) { clear_enqueued_jobs }
|
||||||
after(:all) { redis_rs_delete_keys("rs:authorizations:*") }
|
after(:all) { redis_rs_delete_keys("authorizations:*") }
|
||||||
|
|
||||||
let(:auth) do
|
let(:auth) do
|
||||||
user.remote_storage_authorizations.create!(
|
user.remote_storage_authorizations.create!(
|
||||||
@ -22,7 +22,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "stores a token in redis" do
|
it "stores a token in redis" do
|
||||||
user_auth_keys = redis_rs.keys("rs:authorizations:#{user.address}:*")
|
user_auth_keys = redis_rs.keys("authorizations:#{user.cn}:*")
|
||||||
expect(user_auth_keys.length).to eq(1)
|
expect(user_auth_keys.length).to eq(1)
|
||||||
|
|
||||||
authorizations = redis_rs.smembers(user_auth_keys.first)
|
authorizations = redis_rs.smembers(user_auth_keys.first)
|
||||||
@ -44,7 +44,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
|||||||
|
|
||||||
describe "#destroy" do
|
describe "#destroy" do
|
||||||
after(:each) { clear_enqueued_jobs }
|
after(:each) { clear_enqueued_jobs }
|
||||||
after(:all) { redis_rs_delete_keys("rs:authorizations:*") }
|
after(:all) { redis_rs_delete_keys("authorizations:*") }
|
||||||
|
|
||||||
it "removes the token from redis" do
|
it "removes the token from redis" do
|
||||||
auth = user.remote_storage_authorizations.create!(
|
auth = user.remote_storage_authorizations.create!(
|
||||||
@ -54,7 +54,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
|||||||
)
|
)
|
||||||
auth.destroy!
|
auth.destroy!
|
||||||
|
|
||||||
expect(redis_rs.keys("rs:authorizations:#{user.address}:*")).to be_empty
|
expect(redis_rs.keys("authorizations:#{user.address}:*")).to be_empty
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with expiry set" do
|
context "with expiry set" do
|
||||||
|
Loading…
x
Reference in New Issue
Block a user