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
|
||||
|
||||
def delete_token_from_redis
|
||||
key = "rs:authorizations:#{user.address}:#{token}"
|
||||
key = "authorizations:#{user.cn}:#{token}"
|
||||
redis.srem? key, redis.smembers(key)
|
||||
end
|
||||
|
||||
@ -44,7 +44,7 @@ class RemoteStorageAuthorization < ApplicationRecord
|
||||
end
|
||||
|
||||
def store_token_in_redis
|
||||
redis.sadd "rs:authorizations:#{user.address}:#{token}", permissions
|
||||
redis.sadd "authorizations:#{user.cn}:#{token}", permissions
|
||||
end
|
||||
|
||||
def schedule_token_expiry
|
||||
|
@ -20,7 +20,7 @@ RSpec.describe RemoteStorageExpireAuthorizationJob, type: :job 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
|
||||
|
||||
perform_enqueued_jobs { job }
|
||||
|
@ -7,7 +7,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
||||
|
||||
describe "#create" do
|
||||
after(:each) { clear_enqueued_jobs }
|
||||
after(:all) { redis_rs_delete_keys("rs:authorizations:*") }
|
||||
after(:all) { redis_rs_delete_keys("authorizations:*") }
|
||||
|
||||
let(:auth) do
|
||||
user.remote_storage_authorizations.create!(
|
||||
@ -22,7 +22,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
||||
end
|
||||
|
||||
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)
|
||||
|
||||
authorizations = redis_rs.smembers(user_auth_keys.first)
|
||||
@ -44,7 +44,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
||||
|
||||
describe "#destroy" do
|
||||
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
|
||||
auth = user.remote_storage_authorizations.create!(
|
||||
@ -54,7 +54,7 @@ RSpec.describe RemoteStorageAuthorization, type: :model do
|
||||
)
|
||||
auth.destroy!
|
||||
|
||||
expect(redis_rs.keys("rs:authorizations:#{user.address}:*")).to be_empty
|
||||
expect(redis_rs.keys("authorizations:#{user.address}:*")).to be_empty
|
||||
end
|
||||
|
||||
context "with expiry set" do
|
||||
|
Loading…
x
Reference in New Issue
Block a user