Skip to content

Fixed development access token generation bug#1335

Merged
RichDom2185 merged 13 commits intosource-academy:masterfrom
geraldnyeo:access-token-bugfix
Feb 28, 2026
Merged

Fixed development access token generation bug#1335
RichDom2185 merged 13 commits intosource-academy:masterfrom
geraldnyeo:access-token-bugfix

Conversation

@geraldnyeo
Copy link
Contributor

#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% (-0.02%) from 89.201%
when pulling 8e244d7 on geraldnyeo:access-token-bugfix
into ce7e5e0 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.

Copy link
Member

@RichDom2185 RichDom2185 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the one comment

Copy link
Member

@RichDom2185 RichDom2185 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@RichDom2185 RichDom2185 enabled auto-merge (squash) February 28, 2026 09:42
@RichDom2185 RichDom2185 merged commit 2f97e82 into source-academy:master Feb 28, 2026
3 checks passed
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.

3 participants