Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add social_auth info to SAR script #970

Merged
merged 1 commit into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion anitya/sar.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,23 @@ def main():

users_list = []
for user in users:
users_list.append(user.to_dict())
user_dict = user.to_dict()
user_social_auths = db.Session.execute(
"SELECT provider,extra_data,uid FROM social_auth_usersocialauth WHERE user_id = :val",
{"val": str(user.id)},
)
user_dict["user_social_auths"] = []
# This part is working in postgresql, but in tests we are using sqlite
# which doesn't know the UUID type
for user_social_auth in user_social_auths: # pragma: no cover
user_dict["user_social_auths"].append(
{
"provider": user_social_auth["provider"],
"extra_data": user_social_auth["extra_data"],
"uid": user_social_auth["uid"],
}
)
users_list.append(user_dict)

json.dump(users_list, sys.stdout)

Expand Down
2 changes: 2 additions & 0 deletions anitya/tests/test_sar.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def test_main_email(self):
"username": user.username,
"email": user.email,
"active": user.active,
"user_social_auths": [],
}
]

Expand Down Expand Up @@ -93,6 +94,7 @@ def test_main_username(self):
"username": user.username,
"email": user.email,
"active": user.active,
"user_social_auths": [],
}
]

Expand Down
1 change: 1 addition & 0 deletions news/PR970.other
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add social auth info to SAR script