-
Notifications
You must be signed in to change notification settings - Fork 108
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 Review Stages Setting #1204
Open
tomatoprinx
wants to merge
31
commits into
master
Choose a base branch
from
feature/add_review_stages_setting
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
04553f9
Initialize setting review / proposal stage page
alice6373 f195f71
Alice fixup with love
alice6373 69a7f07
Clear gui
alice6373 7300021
Default timezone sring handling
alice6373 a036250
rename to Review Stages
alice6373 81d875e
Generating timezone dynamically with pytz
alice6373 1397208
Delete comment in review_stages.html
alice6373 1f485a3
Delete print() in view.py
alice6373 db36ab6
Update GUI
alice6373 d867fc2
return value add reviews_state()
alice6373 65016fa
Rename First Round Review_2 to First Round Review
alice6373 95d6dc9
Change the typography to vertical
alice6373 b56946c
Rename First Round Review_1 to Locked (proposal editing and reviewing…
alice6373 663e433
Enhance user friendliness : accepting pycontw-2020.proposals.disable.…
alice6373 c2a6d53
Enhance user friendliness : Try more django date format (DATETIME_INP…
alice6373 cc7fc66
Enhance user friendliness : display current review stage setting
alice6373 8547598
Enhance user friendliness : automatically load the current settings t…
alice6373 aaa5034
Move url.py & view.py to more precise folder
alice6373 0ad9045
Fix problem that current settings will not be loaded after submitting…
alice6373 f2dd18e
proposals.disabled.after not be required
alice6373 eef9a46
Remove unnecessary parentheses and harcoded key
tomatoprinx 4fac698
Fix duplicated return() and safeguard current_review_stages_setting f…
tomatoprinx 4e0bcdd
Fix `proposals.disable.after` value rendering in input element
tomatoprinx d73d206
Update panel font color for user experience
tomatoprinx 007022a
Update message files for translations
tomatoprinx ef2e045
Fix ruff check errors
tomatoprinx 8b9d274
Fix element id
tomatoprinx 1edd88c
Add test method for configuration_switch
tomatoprinx 978f2f6
add test for review stages
tomatoprinx e8e0e82
fix ruff check
tomatoprinx ee689cc
Merge branch 'master' into feature/add_review_stages_setting
tomatoprinx 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 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 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 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 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
File renamed without changes.
This file contains 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,82 @@ | ||
from unittest.mock import patch | ||
|
||
import pytest | ||
from django.urls import reverse | ||
|
||
|
||
@pytest.fixture | ||
def review_stages_url(): | ||
return reverse('review_stages') | ||
|
||
@pytest.mark.django_db | ||
def test_review_stages_get(client, review_stages_url): | ||
response = client.get(review_stages_url) | ||
|
||
assert response.status_code == 200 | ||
assert 'review_stages_list' in response.context | ||
assert 'current_review_stages_setting' in response.context | ||
|
||
@pytest.mark.django_db | ||
@patch('reviews.views.reg') | ||
@patch('reviews.views.messages') | ||
def test_review_stages_post_valid_data(mock_messages, mock_reg, client, review_stages_url): | ||
mock_reg.get.return_value = '' | ||
mock_reg.__setitem__.side_effect = lambda key, value: None | ||
|
||
post_data = { | ||
'proposals.creatable': 'True', | ||
'proposals.editable': 'True', | ||
'proposals.withdrawable': 'True', | ||
'reviews.visible.to.submitters': 'True', | ||
'reviews.stage': '1', | ||
'proposals.disable.after': '2024-12-31T12:00', | ||
'review_timezone': 'UTC', | ||
} | ||
|
||
response = client.post(review_stages_url, post_data) | ||
|
||
assert response.status_code == 200 | ||
mock_messages.info.assert_called_once_with( | ||
response.wsgi_request, 'This setting has been changed successfully.' | ||
) | ||
|
||
@pytest.mark.django_db | ||
@patch('reviews.views.reg') | ||
@patch('reviews.views.messages') | ||
def test_review_stages_post_invalid_date(mock_messages, mock_reg, client, review_stages_url): | ||
post_data = { | ||
'proposals.creatable': 'True', | ||
'proposals.editable': 'True', | ||
'proposals.withdrawable': 'True', | ||
'reviews.visible.to.submitters': 'True', | ||
'reviews.stage': '1', | ||
'proposals.disable.after': 'invalid-date', | ||
'review_timezone': '', | ||
} | ||
|
||
response = client.post(review_stages_url, post_data) | ||
|
||
assert response.status_code == 200 | ||
mock_messages.error.assert_called_once_with( | ||
response.wsgi_request, 'Please input valid date format : " + "%Y-%m-%dT%H:%M' | ||
) | ||
|
||
@pytest.mark.django_db | ||
def test_review_stages_timezone_conversion(client, review_stages_url): | ||
post_data = { | ||
'proposals.creatable': 'True', | ||
'proposals.editable': 'True', | ||
'proposals.withdrawable': 'True', | ||
'reviews.visible.to.submitters': 'True', | ||
'reviews.stage': '1', | ||
'proposals.disable.after': '2024-12-31T12:00', | ||
'review_timezone': 'Asia/Taipei', | ||
} | ||
|
||
with patch('reviews.views.pytz.timezone') as mock_timezone: | ||
mock_timezone.return_value.localize.return_value.strftime.return_value = '2024-12-31 12:00:00-0500' | ||
response = client.post(review_stages_url, post_data) | ||
|
||
assert response.status_code == 200 | ||
assert mock_timezone.call_count == 1 | ||
assert mock_timezone.called_with('Asia/Taipei') |
This file contains 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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
from django.conf.urls import url | ||
|
||
from . import views | ||
from .views import ReviewEditView, TalkProposalListView | ||
|
||
urlpatterns = [ | ||
url(r'^$', TalkProposalListView.as_view(), name='review_proposal_list'), | ||
url(r'^talk/(?P<proposal_pk>\d+)/$', | ||
ReviewEditView.as_view(), name='review_edit'), | ||
url(r'^review-stages/$', views.review_stages, name='review_stages'), | ||
] |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please fix the translation entries with fuzzy marks