Skip to content

Comments

Fixed development access token generation bug#1335

Open
geraldnyeo wants to merge 11 commits intosource-academy:masterfrom
geraldnyeo:access-token-bugfix
Open

Fixed development access token generation bug#1335
geraldnyeo wants to merge 11 commits intosource-academy:masterfrom
geraldnyeo:access-token-bugfix

Conversation

@geraldnyeo
Copy link

#1334
Updated query in the test_user function in lib/mix/tasks/token.ex to include a join clause between the 'users' and 'courses' table.

Comment on lines 62 to 69
if Cadet.Env.env() in @env_allow_mock do
user =
User
|> where(role: ^role)
|> join(:inner, [u], cr in "course_registrations", on: u.id == cr.user_id)
|> where([u, cr], cr.role == ^role)
|> first
|> Repo.one()

This comment was marked as outdated.

@coveralls
Copy link

coveralls commented Feb 20, 2026

Coverage Status

coverage: 89.178%. remained the same
when pulling cf9ba36 on geraldnyeo:access-token-bugfix
into 9a7da2c on source-academy:master.

@geraldnyeo geraldnyeo closed this Feb 20, 2026
@geraldnyeo geraldnyeo reopened this Feb 20, 2026
Comment on lines 74 to 78
%User{}
|> User.changeset(%{name: "Test#{role_capitalized}", role: role})
|> User.changeset(%{name: "Test#{role_capitalized}", username: "test_#{role}", provider: "test"})
|> Repo.insert!()
end
end

This comment was marked as outdated.

Comment on lines 76 to 78
course = case Repo.one(Course) do
course -> course
nil ->

This comment was marked as outdated.

%User{}
|> User.changeset(%{name: "Test#{role_capitalized}", role: role})
course =
case Repo.one(Course) do

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants