Skip to content

Commit 1de6dcb

Browse files
woodruffwSamirPS
authored andcommitted
warehouse, tests: remove the journal view (pypi#11962)
1 parent e8e54a2 commit 1de6dcb

File tree

7 files changed

+3
-290
lines changed

7 files changed

+3
-290
lines changed

tests/unit/manage/test_views.py

Lines changed: 0 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -8443,125 +8443,6 @@ def test_raises_404_with_out_of_range_page(self, db_request):
84438443
assert views.manage_project_history(project, db_request)
84448444

84458445

8446-
class TestManageProjectJournal:
8447-
def test_get(self, db_request):
8448-
project = ProjectFactory.create()
8449-
older_journal = JournalEntryFactory.create(
8450-
name=project.name,
8451-
submitted_date=datetime.datetime(2017, 2, 5, 17, 18, 18, 462_634),
8452-
)
8453-
newer_journal = JournalEntryFactory.create(
8454-
name=project.name,
8455-
submitted_date=datetime.datetime(2018, 2, 5, 17, 18, 18, 462_634),
8456-
)
8457-
8458-
assert views.manage_project_journal(project, db_request) == {
8459-
"project": project,
8460-
"journals": [newer_journal, older_journal],
8461-
}
8462-
8463-
def test_raises_400_with_pagenum_type_str(self, monkeypatch, db_request):
8464-
params = MultiDict({"page": "abc"})
8465-
db_request.params = params
8466-
8467-
journals_query = pretend.stub()
8468-
db_request.journals_query = pretend.stub(
8469-
journals_query=lambda *a, **kw: journals_query
8470-
)
8471-
8472-
page_obj = pretend.stub(page_count=10, item_count=1000)
8473-
page_cls = pretend.call_recorder(lambda *a, **kw: page_obj)
8474-
monkeypatch.setattr(views, "SQLAlchemyORMPage", page_cls)
8475-
8476-
url_maker = pretend.stub()
8477-
url_maker_factory = pretend.call_recorder(lambda request: url_maker)
8478-
monkeypatch.setattr(views, "paginate_url_factory", url_maker_factory)
8479-
8480-
project = ProjectFactory.create()
8481-
with pytest.raises(HTTPBadRequest):
8482-
views.manage_project_journal(project, db_request)
8483-
8484-
assert page_cls.calls == []
8485-
8486-
def test_first_page(self, db_request):
8487-
page_number = 1
8488-
params = MultiDict({"page": page_number})
8489-
db_request.params = params
8490-
8491-
project = ProjectFactory.create()
8492-
items_per_page = 25
8493-
total_items = items_per_page + 2
8494-
for _ in range(total_items):
8495-
JournalEntryFactory.create(
8496-
name=project.name, submitted_date=datetime.datetime.now()
8497-
)
8498-
journals_query = (
8499-
db_request.db.query(JournalEntry)
8500-
.options(joinedload("submitted_by"))
8501-
.filter(JournalEntry.name == project.name)
8502-
.order_by(JournalEntry.submitted_date.desc(), JournalEntry.id.desc())
8503-
)
8504-
8505-
journals_page = SQLAlchemyORMPage(
8506-
journals_query,
8507-
page=page_number,
8508-
items_per_page=items_per_page,
8509-
item_count=total_items,
8510-
url_maker=paginate_url_factory(db_request),
8511-
)
8512-
assert views.manage_project_journal(project, db_request) == {
8513-
"project": project,
8514-
"journals": journals_page,
8515-
}
8516-
8517-
def test_last_page(self, db_request):
8518-
page_number = 2
8519-
params = MultiDict({"page": page_number})
8520-
db_request.params = params
8521-
8522-
project = ProjectFactory.create()
8523-
items_per_page = 25
8524-
total_items = items_per_page + 2
8525-
for _ in range(total_items):
8526-
JournalEntryFactory.create(
8527-
name=project.name, submitted_date=datetime.datetime.now()
8528-
)
8529-
journals_query = (
8530-
db_request.db.query(JournalEntry)
8531-
.options(joinedload("submitted_by"))
8532-
.filter(JournalEntry.name == project.name)
8533-
.order_by(JournalEntry.submitted_date.desc(), JournalEntry.id.desc())
8534-
)
8535-
8536-
journals_page = SQLAlchemyORMPage(
8537-
journals_query,
8538-
page=page_number,
8539-
items_per_page=items_per_page,
8540-
item_count=total_items,
8541-
url_maker=paginate_url_factory(db_request),
8542-
)
8543-
assert views.manage_project_journal(project, db_request) == {
8544-
"project": project,
8545-
"journals": journals_page,
8546-
}
8547-
8548-
def test_raises_404_with_out_of_range_page(self, db_request):
8549-
page_number = 3
8550-
params = MultiDict({"page": page_number})
8551-
db_request.params = params
8552-
8553-
project = ProjectFactory.create()
8554-
items_per_page = 25
8555-
total_items = items_per_page + 2
8556-
for _ in range(total_items):
8557-
JournalEntryFactory.create(
8558-
name=project.name, submitted_date=datetime.datetime.now()
8559-
)
8560-
8561-
with pytest.raises(HTTPNotFound):
8562-
assert views.manage_project_journal(project, db_request)
8563-
8564-
85658446
class TestManageOIDCProviderViews:
85668447
def test_initializes(self):
85678448
metrics = pretend.stub()

tests/unit/test_routes.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -438,13 +438,6 @@ def add_policy(name, filename):
438438
traverse="/{project_name}",
439439
domain=warehouse,
440440
),
441-
pretend.call(
442-
"manage.project.journal",
443-
"/manage/project/{project_name}/journal/",
444-
factory="warehouse.packaging.models:ProjectFactory",
445-
traverse="/{project_name}",
446-
domain=warehouse,
447-
),
448441
pretend.call(
449442
"packaging.project",
450443
"/project/{name}/",

warehouse/locale/messages.pot

Lines changed: 3 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -2431,7 +2431,7 @@ msgid "Teams"
24312431
msgstr ""
24322432

24332433
#: warehouse/templates/includes/manage/manage-organization-menu.html:37
2434-
#: warehouse/templates/includes/manage/manage-project-menu.html:59
2434+
#: warehouse/templates/includes/manage/manage-project-menu.html:53
24352435
#: warehouse/templates/includes/manage/manage-team-menu.html:31
24362436
msgid "Settings"
24372437
msgstr ""
@@ -2456,16 +2456,12 @@ msgstr ""
24562456
msgid "Security history"
24572457
msgstr ""
24582458

2459-
#: warehouse/templates/includes/manage/manage-project-menu.html:37
2460-
msgid "Journal"
2461-
msgstr ""
2462-
2463-
#: warehouse/templates/includes/manage/manage-project-menu.html:44
2459+
#: warehouse/templates/includes/manage/manage-project-menu.html:38
24642460
#: warehouse/templates/manage/project/documentation.html:21
24652461
msgid "Documentation"
24662462
msgstr ""
24672463

2468-
#: warehouse/templates/includes/manage/manage-project-menu.html:52
2464+
#: warehouse/templates/includes/manage/manage-project-menu.html:46
24692465
msgid "Publishing"
24702466
msgstr ""
24712467

@@ -4079,8 +4075,6 @@ msgstr ""
40794075

40804076
#: warehouse/templates/manage/organization/roles.html:59
40814077
#: warehouse/templates/manage/organization/roles.html:190
4082-
#: warehouse/templates/manage/project/journal.html:37
4083-
#: warehouse/templates/manage/project/journal.html:52
40844078
#: warehouse/templates/manage/project/roles.html:374
40854079
#: warehouse/templates/manage/team/roles.html:43
40864080
#: warehouse/templates/manage/team/roles.html:94
@@ -4321,53 +4315,6 @@ msgstr ""
43214315
msgid "Security history for %(project_name)s"
43224316
msgstr ""
43234317

4324-
#: warehouse/templates/manage/project/journal.html:20
4325-
#, python-format
4326-
msgid "'%(project_name)s' project journal"
4327-
msgstr ""
4328-
4329-
#: warehouse/templates/manage/project/journal.html:23
4330-
msgid "Project journal"
4331-
msgstr ""
4332-
4333-
#: warehouse/templates/manage/project/journal.html:25
4334-
msgid ""
4335-
"Each time you or your collaborators update this project, the action is "
4336-
"recorded and displayed here."
4337-
msgstr ""
4338-
4339-
#: warehouse/templates/manage/project/journal.html:28
4340-
#, python-format
4341-
msgid ""
4342-
"This feature will be deprecated in the future, replaced by the <a "
4343-
"href=\"%(href)s\">security history page</a>."
4344-
msgstr ""
4345-
4346-
#: warehouse/templates/manage/project/journal.html:32
4347-
#, python-format
4348-
msgid "History for %(project_name)s"
4349-
msgstr ""
4350-
4351-
#: warehouse/templates/manage/project/journal.html:35
4352-
#: warehouse/templates/manage/project/journal.html:44
4353-
msgid "Action"
4354-
msgstr ""
4355-
4356-
#: warehouse/templates/manage/project/journal.html:36
4357-
#: warehouse/templates/manage/project/journal.html:48
4358-
msgid "Date"
4359-
msgstr ""
4360-
4361-
#: warehouse/templates/manage/project/journal.html:45
4362-
#, python-format
4363-
msgid "Release %(version)s:"
4364-
msgstr ""
4365-
4366-
#: warehouse/templates/manage/project/journal.html:54
4367-
#, python-format
4368-
msgid "from %(ip_address)s"
4369-
msgstr ""
4370-
43714318
#: warehouse/templates/manage/project/manage_project_base.html:20
43724319
#, python-format
43734320
msgid "Manage '%(project_name)s'"

warehouse/manage/views.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4502,40 +4502,6 @@ def manage_project_history(project, request):
45024502
return {"project": project, "events": events}
45034503

45044504

4505-
@view_config(
4506-
route_name="manage.project.journal",
4507-
context=Project,
4508-
renderer="manage/project/journal.html",
4509-
uses_session=True,
4510-
permission="manage:project",
4511-
has_translations=True,
4512-
)
4513-
def manage_project_journal(project, request):
4514-
try:
4515-
page_num = int(request.params.get("page", 1))
4516-
except ValueError:
4517-
raise HTTPBadRequest("'page' must be an integer.")
4518-
4519-
journals_query = (
4520-
request.db.query(JournalEntry)
4521-
.options(joinedload("submitted_by"))
4522-
.filter(JournalEntry.name == project.name)
4523-
.order_by(JournalEntry.submitted_date.desc(), JournalEntry.id.desc())
4524-
)
4525-
4526-
journals = SQLAlchemyORMPage(
4527-
journals_query,
4528-
page=page_num,
4529-
items_per_page=25,
4530-
url_maker=paginate_url_factory(request),
4531-
)
4532-
4533-
if journals.page_count and page_num > journals.page_count:
4534-
raise HTTPNotFound
4535-
4536-
return {"project": project, "journals": journals}
4537-
4538-
45394505
@view_config(
45404506
route_name="manage.project.documentation",
45414507
context=Project,

warehouse/routes.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -422,13 +422,6 @@ def includeme(config):
422422
traverse="/{project_name}",
423423
domain=warehouse,
424424
)
425-
config.add_route(
426-
"manage.project.journal",
427-
"/manage/project/{project_name}/journal/",
428-
factory="warehouse.packaging.models:ProjectFactory",
429-
traverse="/{project_name}",
430-
domain=warehouse,
431-
)
432425

433426
# Packaging
434427
config.add_redirect("/p/{name}/", "/project/{name}/", domain=warehouse)

warehouse/templates/includes/manage/manage-project-menu.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@
3131
{% trans %}Security history{% endtrans %}
3232
</a>
3333
</li>
34-
<li>
35-
<a href="{{ request.route_path('manage.project.journal', project_name=project.normalized_name)}}" class="vertical-tabs__tab vertical-tabs__tab--with-icon {% if active_tab == 'journal' %}vertical-tabs__tab--is-active{% endif %} {% if mode == 'mobile' %}vertical-tabs__tab--mobile{% endif %}" {% if active_tab == 'journal' %}aria-selected="true"{% endif %}>
36-
<i class="fa fa-history" aria-hidden="true"></i>
37-
{% trans %}Journal{% endtrans %}
38-
</a>
39-
</li>
4034
{% if project.has_docs %}
4135
<li>
4236
<a href="{{ request.route_path('manage.project.documentation', project_name=project.normalized_name)}}" class="vertical-tabs__tab vertical-tabs__tab--with-icon {% if active_tab == 'documentation' %}vertical-tabs__tab--is-active{% endif %} {% if mode == 'mobile' %}vertical-tabs__tab--mobile{% endif %}" {% if active_tab == 'documentation' %}aria-selected="true"{% endif %}>

warehouse/templates/manage/project/journal.html

Lines changed: 0 additions & 61 deletions
This file was deleted.

0 commit comments

Comments
 (0)