-
Notifications
You must be signed in to change notification settings - Fork 1k
User updates RSS feed #6938
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
Closed
Closed
User updates RSS feed #6938
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
2654aba
user rss feed implemented and tested
rascalking edbbd19
link to the feed from the user's profile page
rascalking abd0137
fix username in rss feed, add alternate link in head
rascalking 13909d9
document user updates rss, fix its caching
rascalking 5abac37
make the linter happy
rascalking c021f62
Merge branch 'master' into 4603-user-rss-feeds
rascalking e08743e
switch to my releases feed, only show user's uploaded releases
rascalking 5cd5d85
add my projects releases rss feed
rascalking 04b4947
whoops, updated the SR description, not the website text
rascalking File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,8 @@ | |
|
||
from warehouse.rss import views as rss | ||
|
||
from ...common.db.packaging import ProjectFactory, ReleaseFactory | ||
from ...common.db.accounts import UserFactory | ||
from ...common.db.packaging import ProjectFactory, ReleaseFactory, RoleFactory | ||
|
||
|
||
def test_rss_updates(db_request): | ||
|
@@ -106,3 +107,64 @@ def test_format_author(db_request): | |
" <[email protected]>" | ||
) | ||
assert rss._format_author(release) == ", ".join(["[email protected]"] * 4) | ||
|
||
|
||
def test_rss_user_my_releases(db_request): | ||
db_request.find_service = pretend.call_recorder( | ||
lambda *args, **kwargs: pretend.stub( | ||
enabled=False, csp_policy=pretend.stub(), merge=lambda _: None | ||
) | ||
) | ||
|
||
db_request.session = pretend.stub() | ||
project1 = ProjectFactory.create() | ||
project2 = ProjectFactory.create() | ||
|
||
user = UserFactory.create() | ||
|
||
RoleFactory.create(user=user, project=project1) | ||
|
||
release1 = ReleaseFactory.create(project=project1) | ||
release1.created = datetime.date(2011, 1, 1) | ||
release1.uploader = user | ||
release2 = ReleaseFactory.create(project=project2) | ||
release2.created = datetime.date(2012, 1, 1) | ||
release2.uploader = user | ||
release3 = ReleaseFactory.create(project=project1) | ||
release3.created = datetime.date(2013, 1, 1) | ||
|
||
assert rss.rss_user_my_releases(user, db_request) == { | ||
"user": user, | ||
"latest_releases": [release2, release1], | ||
} | ||
assert db_request.response.content_type == "text/xml" | ||
|
||
|
||
def test_rss_user_my_project_releases(db_request): | ||
db_request.find_service = pretend.call_recorder( | ||
lambda *args, **kwargs: pretend.stub( | ||
enabled=False, csp_policy=pretend.stub(), merge=lambda _: None | ||
) | ||
) | ||
|
||
db_request.session = pretend.stub() | ||
project1 = ProjectFactory.create() | ||
project2 = ProjectFactory.create() | ||
|
||
user = UserFactory.create() | ||
|
||
RoleFactory.create(user=user, project=project1) | ||
|
||
release1 = ReleaseFactory.create(project=project1) | ||
release1.created = datetime.date(2011, 1, 1) | ||
release1.uploader = user | ||
release2 = ReleaseFactory.create(project=project2) | ||
release2.created = datetime.date(2012, 1, 1) | ||
release3 = ReleaseFactory.create(project=project1) | ||
release3.created = datetime.date(2013, 1, 1) | ||
|
||
assert rss.rss_user_my_project_releases(user, db_request) == { | ||
"user": user, | ||
"latest_releases": [release3, release1], | ||
} | ||
assert db_request.response.content_type == "text/xml" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{% extends "base.xml" %} | ||
{% block title %}{{ user.username }}'s projects recent releases{% endblock %} | ||
{% block description %}Recent releases from projects {{ user.username }} owns or maintains to the Python Package Index{% endblock %} | ||
{% block items -%} | ||
{% for release in latest_releases %} | ||
<item> | ||
<title>{{ release.project.name }} {{ release.version }}</title> | ||
<link>{{ request.route_url('packaging.release', name=release.project.normalized_name, version=release.version) }}</link> | ||
<description>{{ release.summary }}</description> | ||
<pubDate>{{ release.created|format_rfc822_datetime() }}</pubDate> | ||
</item> | ||
{%- endfor %} | ||
{%- endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{% extends "base.xml" %} | ||
{% block title %}{{ user.username }}'s recent releases{% endblock %} | ||
{% block description %}Recent releases from {{ user.username }} to the Python Package Index{% endblock %} | ||
{% block items -%} | ||
{% for release in latest_releases %} | ||
<item> | ||
<title>{{ release.project.name }} {{ release.version }}</title> | ||
<link>{{ request.route_url('packaging.release', name=release.project.normalized_name, version=release.version) }}</link> | ||
<description>{{ release.summary }}</description> | ||
<pubDate>{{ release.created|format_rfc822_datetime() }}</pubDate> | ||
</item> | ||
{%- endfor %} | ||
{%- endblock %} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.