-
Notifications
You must be signed in to change notification settings - Fork 378
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow blanket IPR disclosures (#7934)
* refactor: avoid shadowing type() * style: Black * feat: is_blanket_disclosure field * feat: add field to form * feat: js to mark field required/not required * feat: blanket disclosure = royalty-free license * feat: manage licensing radio buttons * fix: adjust wording/format of disclosure page * fix: point at RFC 8179 in checkbox label * test: test blanket disclosure licensing restrictions * fix: conditionally render is_blanket_disclosure * test: refactor test case * test: patent details optional for blanket ipr
- Loading branch information
1 parent
3507466
commit 32057f3
Showing
8 changed files
with
275 additions
and
69 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
16 changes: 16 additions & 0 deletions
16
ietf/ipr/migrations/0004_holderiprdisclosure_is_blanket_disclosure.py
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,16 @@ | ||
# Copyright The IETF Trust 2024, All Rights Reserved | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("ipr", "0003_alter_iprdisclosurebase_docs"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="holderiprdisclosure", | ||
name="is_blanket_disclosure", | ||
field=models.BooleanField(default=False), | ||
), | ||
] |
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 |
---|---|---|
|
@@ -33,7 +33,7 @@ | |
IprDocRelFactory, | ||
IprEventFactory | ||
) | ||
from ietf.ipr.forms import DraftForm | ||
from ietf.ipr.forms import DraftForm, HolderIprDisclosureForm | ||
from ietf.ipr.mail import (process_response_email, get_reply_to, get_update_submitter_emails, | ||
get_pseudo_submitter, get_holders, get_update_cc_addrs) | ||
from ietf.ipr.models import (IprDisclosureBase,GenericIprDisclosure,HolderIprDisclosure, | ||
|
@@ -272,16 +272,16 @@ def test_sitemap(self): | |
|
||
def test_new_generic(self): | ||
"""Ensure new-generic redirects to new-general""" | ||
url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "generic" }) | ||
url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "generic" }) | ||
r = self.client.get(url) | ||
self.assertEqual(r.status_code,302) | ||
self.assertEqual(urlparse(r["Location"]).path, urlreverse("ietf.ipr.views.new", kwargs={ "type": "general"})) | ||
self.assertEqual(urlparse(r["Location"]).path, urlreverse("ietf.ipr.views.new", kwargs={ "_type": "general"})) | ||
|
||
|
||
def test_new_general(self): | ||
"""Add a new general disclosure. Note: submitter does not need to be logged in. | ||
""" | ||
url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "general" }) | ||
url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "general" }) | ||
|
||
# invalid post | ||
r = self.client.post(url, { | ||
|
@@ -319,7 +319,7 @@ def test_new_specific(self): | |
""" | ||
draft = WgDraftFactory() | ||
rfc = WgRfcFactory() | ||
url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "specific" }) | ||
url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "specific" }) | ||
|
||
# successful post | ||
empty_outbox() | ||
|
@@ -375,7 +375,7 @@ def test_new_specific(self): | |
def test_new_specific_no_revision(self): | ||
draft = WgDraftFactory() | ||
rfc = WgRfcFactory() | ||
url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "specific" }) | ||
url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "specific" }) | ||
|
||
# successful post | ||
empty_outbox() | ||
|
@@ -409,7 +409,7 @@ def test_new_thirdparty(self): | |
""" | ||
draft = WgDraftFactory() | ||
rfc = WgRfcFactory() | ||
url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "third-party" }) | ||
url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "third-party" }) | ||
|
||
# successful post | ||
empty_outbox() | ||
|
@@ -456,7 +456,7 @@ def test_edit(self): | |
r = self.client.get(url) | ||
self.assertContains(r, original_ipr.holder_legal_name) | ||
|
||
#url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "specific" }) | ||
#url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "specific" }) | ||
# successful post | ||
empty_outbox() | ||
post_data = { | ||
|
@@ -503,7 +503,7 @@ def test_update(self): | |
r = self.client.get(url) | ||
self.assertContains(r, original_ipr.title) | ||
|
||
#url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "specific" }) | ||
#url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "specific" }) | ||
# successful post | ||
empty_outbox() | ||
r = self.client.post(url, { | ||
|
@@ -543,7 +543,7 @@ def test_update(self): | |
|
||
def test_update_bad_post(self): | ||
draft = WgDraftFactory() | ||
url = urlreverse("ietf.ipr.views.new", kwargs={ "type": "specific" }) | ||
url = urlreverse("ietf.ipr.views.new", kwargs={ "_type": "specific" }) | ||
|
||
empty_outbox() | ||
r = self.client.post(url, { | ||
|
@@ -1022,3 +1022,61 @@ def test_revisions_invalid(self): | |
"revisions", | ||
null_char_error_msg, | ||
) | ||
|
||
|
||
class HolderIprDisclosureFormTests(TestCase): | ||
def setUp(self): | ||
super().setUp() | ||
# Checkboxes that are False are left out of the Form data, not sent back at all. These are | ||
# commented out - if they were checked, their value would be "on". | ||
self.data = { | ||
"holder_legal_name": "Test Legal", | ||
"holder_contact_name": "Test Holder", | ||
"holder_contact_email": "[email protected]", | ||
"holder_contact_info": "555-555-0100", | ||
"ietfer_name": "Test Participant", | ||
"ietfer_contact_info": "555-555-0101", | ||
"iprdocrel_set-TOTAL_FORMS": 2, | ||
"iprdocrel_set-INITIAL_FORMS": 0, | ||
"iprdocrel_set-0-document": "1234", # fake id - validates but won't save() | ||
"iprdocrel_set-0-revisions": '00', | ||
"iprdocrel_set-1-document": "4567", # fake id - validates but won't save() | ||
# "is_blanket_disclosure": "on", | ||
"patent_number": "SE12345678901", | ||
"patent_inventor": "A. Nonymous", | ||
"patent_title": "A method of transferring bits", | ||
"patent_date": "2000-01-01", | ||
# "has_patent_pending": "on", | ||
"licensing": "reasonable", | ||
"submitter_name": "Test Holder", | ||
"submitter_email": "[email protected]", | ||
} | ||
|
||
def test_blanket_disclosure_licensing_restrictions(self): | ||
"""when is_blanket_disclosure is True only royalty-free licensing is valid | ||
Most of the form functionality is tested via the views in IprTests above. More thorough testing | ||
of validation ought to move here so we don't have to exercise the whole Django plumbing repeatedly. | ||
""" | ||
self.assertTrue(HolderIprDisclosureForm(data=self.data).is_valid()) | ||
self.data["is_blanket_disclosure"] = "on" | ||
self.assertFalse(HolderIprDisclosureForm(data=self.data).is_valid()) | ||
self.data["licensing"] = "royalty-free" | ||
self.assertTrue(HolderIprDisclosureForm(data=self.data).is_valid()) | ||
|
||
def test_patent_details_required_unless_blanket(self): | ||
self.assertTrue(HolderIprDisclosureForm(data=self.data).is_valid()) | ||
patent_fields = ["patent_number", "patent_inventor", "patent_title", "patent_date"] | ||
# any of the fields being missing should invalidate the form | ||
for pf in patent_fields: | ||
val = self.data.pop(pf) | ||
self.assertFalse(HolderIprDisclosureForm(data=self.data).is_valid()) | ||
self.data[pf] = val | ||
|
||
# should be optional if is_blanket_disclosure is True | ||
self.data["is_blanket_disclosure"] = "on" | ||
self.data["licensing"] = "royalty-free" # also needed for a blanket disclosure | ||
for pf in patent_fields: | ||
val = self.data.pop(pf) | ||
self.assertTrue(HolderIprDisclosureForm(data=self.data).is_valid()) | ||
self.data[pf] = val |
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
Oops, something went wrong.