-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #787 from chinapandaman/PPF-786
PPF-786: implement use full widget name
- Loading branch information
Showing
7 changed files
with
109 additions
and
4 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
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
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
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,52 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import pytest | ||
|
||
from PyPDFForm import PdfWrapper | ||
|
||
|
||
def test_init(sample_template_with_full_key): | ||
obj = PdfWrapper(sample_template_with_full_key, use_full_widget_name=True) | ||
assert "Gain de 2 classes.0" in obj.widgets | ||
assert obj.widgets["Gain de 2 classes.0"] is obj.widgets["0"] | ||
|
||
|
||
def test_sample_data(sample_template_with_full_key): | ||
obj = PdfWrapper(sample_template_with_full_key, use_full_widget_name=True) | ||
assert "Gain de 2 classes.0" in obj.sample_data | ||
assert obj.sample_data["Gain de 2 classes.0"] == obj.sample_data["0"] | ||
|
||
|
||
def test_fill(sample_template_with_full_key): | ||
obj_1 = PdfWrapper(sample_template_with_full_key, use_full_widget_name=True) | ||
obj_2 = PdfWrapper(sample_template_with_full_key, use_full_widget_name=True) | ||
|
||
assert obj_1.fill( | ||
{ | ||
"Gain de 2 classes.0": True | ||
} | ||
).read() == obj_2.fill( | ||
{ | ||
"0": True | ||
} | ||
).read() | ||
|
||
|
||
def test_update_widget_key(sample_template_with_full_key): | ||
obj = PdfWrapper(sample_template_with_full_key, use_full_widget_name=True) | ||
|
||
with pytest.raises(NotImplementedError): | ||
obj.update_widget_key("0", "foo") | ||
|
||
|
||
def test_commit_widget_key_updates(sample_template_with_full_key): | ||
obj = PdfWrapper(sample_template_with_full_key, use_full_widget_name=True) | ||
|
||
with pytest.raises(NotImplementedError): | ||
obj.commit_widget_key_updates() | ||
|
||
|
||
def test_schema(sample_template_with_full_key): | ||
obj = PdfWrapper(sample_template_with_full_key, use_full_widget_name=True) | ||
assert "Gain de 2 classes.0" in obj.schema["properties"] | ||
assert obj.schema["properties"]["Gain de 2 classes.0"] == obj.schema["properties"]["0"] |