-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
76 additions
and
57 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,7 @@ jobs: | |
strategy: | ||
matrix: | ||
config: | ||
- ["Py3.8-Plone5.2", "3.8", "5.2"] | ||
- ["Py3.8-Plone6.0", "3.8", "6.0"] | ||
- ["Py3.8-Plone6.0", "3.8"] | ||
runs-on: ubuntu-latest | ||
name: ${{ matrix.config[0] }} | ||
steps: | ||
|
@@ -42,17 +41,13 @@ jobs: | |
run: | | ||
sudo locale-gen en_US.UTF-8 nl_NL@euro | ||
python -m venv . | ||
ln -s requirements-${{ matrix.config[2] }}.txt requirements.txt | ||
bin/pip install -r requirements.txt | ||
ln -s versions-${{ matrix.config[2] }}.cfg versions.cfg | ||
bin/buildout -c .github.cfg | ||
- name: Pre commit | ||
uses: pre-commit/[email protected] | ||
if: ${{ matrix.config[2] == '5.2' }} | ||
- name: Code Analysis | ||
run: | | ||
bin/code-analysis | ||
if: ${{ matrix.config[2] == '5.2' }} | ||
- name: Test | ||
run: | | ||
bin/coverage run bin/test -s osha.oira | ||
|
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 was deleted.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,64 @@ def test_mailing_lists(self): | |
results, | ||
) | ||
|
||
def test_mailing_lists_batching(self): | ||
request = self.request.clone() | ||
request.form = {"user_id": "admin", "page_limit": "2"} | ||
with mock.patch.object( | ||
MailingListsJson, | ||
"addresses_view", | ||
return_value=GroupToAddresses(context=self.portal.client, request=request), | ||
): | ||
view = MailingListsJson(context=self.portal.client, request=request) | ||
results = view.results | ||
|
||
# Result = 3, because the "general" mailing list is always added | ||
# on page one for admin users. | ||
self.assertEqual(len(results), 3) | ||
self.assertEqual( | ||
results[0], | ||
{"id": "general|QWxsIHVzZXJz", "text": "All users [0 subscribers]"}, | ||
) | ||
self.assertEqual( | ||
results[1], | ||
{ | ||
"id": "nl/test/second-survey|U2Vjb25kIFN1cnZleQ==", | ||
"text": "Second Survey (nl/test/second-survey) [0 subscribers]", | ||
}, | ||
) | ||
self.assertEqual( | ||
results[2], | ||
{ | ||
"id": "nl/ict/software-development|U29mdHdhcmUgZGV2ZWxvcG1lbnQ=", | ||
"text": "Software development (nl/ict/software-development) [0 subscribers]", # noqa: E501 | ||
}, | ||
) | ||
|
||
request.form = {"user_id": "admin", "page_limit": "2", "page": "2"} | ||
with mock.patch.object( | ||
MailingListsJson, | ||
"addresses_view", | ||
return_value=GroupToAddresses(context=self.portal.client, request=request), | ||
): | ||
view = MailingListsJson(context=self.portal.client, request=request) | ||
results = view.results | ||
|
||
self.assertEqual(len(results), 2) | ||
self.assertEqual( | ||
results[0], | ||
{ | ||
"id": "nl-nl|VGhlIE5ldGhlcmxhbmRzIChubCk=", | ||
"text": "The Netherlands (nl) [0 subscribers]", | ||
}, | ||
) | ||
self.assertEqual( | ||
results[1], | ||
{ | ||
"id": "nl-fr|VGhlIE5ldGhlcmxhbmRzIChmcik=", | ||
"text": "The Netherlands (fr) [0 subscribers]", | ||
}, | ||
) | ||
|
||
def test_group_to_addresses(self): | ||
user = Account(loginname="[email protected]", password="secret") | ||
Session.add(user) | ||
|
This file was deleted.
Oops, something went wrong.
File renamed without changes.