generated from superdesk/newsroom-app
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/cn-develop' into cn-uat
- Loading branch information
Showing
12 changed files
with
262 additions
and
95 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import superdesk | ||
|
||
|
||
def validate_product_refs(products): | ||
products_service = superdesk.get_resource_service("products") | ||
for product_spec in products: | ||
product = products_service.find_one(req=None, _id=product_spec["_id"]) | ||
assert product is not None and product["product_type"] == product_spec.get( | ||
"section" | ||
), ( | ||
f"invalid product type for product {product_spec['_id']}, should be {product['product_type']}" | ||
if product | ||
else f"unknown product {product_spec['_id']}" | ||
) |
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 |
---|---|---|
|
@@ -81,4 +81,62 @@ Feature: Management API - Companies | |
] | ||
} | ||
""" | ||
|
||
|
||
Scenario: Validate company products section | ||
Given "products" | ||
""" | ||
[ | ||
{"name": "test", "query": "test", "product_type": "agenda"} | ||
] | ||
""" | ||
|
||
When we post to "/companies" | ||
""" | ||
{ | ||
"name": "zzz company", | ||
"contact_name": "zzz company", | ||
"contact_email": "[email protected]", | ||
"phone": "99999999", | ||
"products": [ | ||
{"_id": "#products._id#", "section": "wire"} | ||
] | ||
} | ||
""" | ||
Then we get error 400 | ||
""" | ||
{"code": 400, "message": "invalid product type for product #products._id#, should be agenda"} | ||
""" | ||
|
||
When we post to "/companies" | ||
""" | ||
{ | ||
"name": "zzz company", | ||
"contact_name": "zzz company", | ||
"contact_email": "[email protected]", | ||
"phone": "99999999", | ||
"products": [ | ||
{"_id": "#products._id#", "section": "agenda"} | ||
] | ||
} | ||
""" | ||
Then we get response code 201 | ||
|
||
When we patch "/companies/#companies._id#" | ||
""" | ||
{ | ||
"products": [ | ||
{"_id": "#products._id#", "section": "wire"} | ||
] | ||
} | ||
""" | ||
Then we get error 400 | ||
|
||
When we patch "/companies/#companies._id#" | ||
""" | ||
{ | ||
"products": [ | ||
{"_id": "#products._id#", "section": "agenda"} | ||
] | ||
} | ||
""" | ||
Then we get response code 200 |
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 |
---|---|---|
|
@@ -110,3 +110,74 @@ Feature: Management API - Users | |
""" | ||
When we delete latest | ||
Then we get ok response | ||
|
||
Scenario: Validate product type | ||
Scenario: Create a user | ||
Given empty "users" | ||
And "products" | ||
""" | ||
[ | ||
{"name": "test", "query": "test", "product_type": "agenda"} | ||
] | ||
""" | ||
And "companies" | ||
""" | ||
[{"name": "zzz company"}] | ||
""" | ||
|
||
When we post to "/users" | ||
""" | ||
{ | ||
"first_name": "John", | ||
"last_name": "Cena", | ||
"email": "[email protected]", | ||
"company": "#companies._id#", | ||
"sections": { | ||
"agenda": true | ||
}, | ||
"products": [ | ||
{"_id": "#products._id#", "section": "wire"} | ||
] | ||
} | ||
""" | ||
Then we get error 400 | ||
""" | ||
{"code": 400, "message": "invalid product type for product #products._id#, should be agenda"} | ||
""" | ||
|
||
When we post to "/users" | ||
""" | ||
{ | ||
"first_name": "John", | ||
"last_name": "Cena", | ||
"email": "[email protected]", | ||
"company": "#companies._id#", | ||
"sections": { | ||
"agenda": true | ||
}, | ||
"products": [ | ||
{"section": "agenda", "_id": "#products._id#"} | ||
] | ||
} | ||
""" | ||
Then we get response code 201 | ||
|
||
When we patch "/users/#users._id#" | ||
""" | ||
{ | ||
"products": [ | ||
{"section": "wire", "_id": "#products._id#"} | ||
] | ||
} | ||
""" | ||
Then we get error 400 | ||
|
||
When we patch "/users/#users._id#" | ||
""" | ||
{ | ||
"products": [ | ||
{"section": "agenda", "_id": "#products._id#"} | ||
] | ||
} | ||
""" | ||
Then we get response code 200 |
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 |
---|---|---|
|
@@ -28,7 +28,11 @@ <h5 class="mb-0">{{ gettext("Login") }}</h5> | |
{% endif %} | ||
|
||
<div class="card-footer bg-white border-0 small"> | ||
{% if get_locale() == "fr_CA" %} | ||
<a href="https://www.thecanadianpress.com/comment-vous-aider/sinscrire-a-nouvellespro/?lang=fr" class="nh-button nh-button--secondary w-100 mb-4 mt-2">{{ gettext("Sign up") }}</a> | ||
{% else %} | ||
<a href="https://www.thecanadianpress.com/contact/pr-signup" class="nh-button nh-button--secondary w-100 mb-4 mt-2">{{ gettext("Sign up") }}</a> | ||
{% endif %} | ||
<p> | ||
{{ gettext('Forgot your password?') }} | ||
<a href="mailto:[email protected]?subject={{ gettext('Please reset my password for NewsPro') }}">{{ gettext('Contact Us') }}</a> | ||
|
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
Binary file not shown.
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