Commit 345b81da authored by Giorgenes Gelatti's avatar Giorgenes Gelatti

Fix dev PAT fixture creation

Existing PAT has wrong digest
and therefore doesn't work.

This makes the creation more
robust and future proof.
parent bf8eadf2
......@@ -2,14 +2,22 @@
require './spec/support/sidekiq_middleware'
# Create an api access token for root user with the value: ypCa3Dzb23o5nvsixwPA
# Create an api access token for root user with the value:
token = 'ypCa3Dzb23o5nvsixwPA'
scopes = Gitlab::Auth.all_available_scopes
Gitlab::Seeder.quiet do
PersonalAccessToken.create!(
user_id: User.find_by(username: 'root').id,
name: "seeded-api-token",
scopes: Gitlab::Auth.all_available_scopes,
token_digest: "/O0jfLERYT/L5gG8nfByQxqTj43TeLlRzOtJGTzRsbQ="
)
User.find_by(username: 'root').tap do |user|
params = {
scopes: scopes.map(&:to_s),
name: 'seeded-api-token'
}
user.personal_access_tokens.build(params).tap do |pat|
pat.set_token(token)
pat.save!
end
end
print '.'
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment