-
Notifications
You must be signed in to change notification settings - Fork 27
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 #2312 from laws-africa/portion
enable italicisation of portion
- Loading branch information
Showing
17 changed files
with
298 additions
and
139 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
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 |
---|---|---|
@@ -1,5 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from nose.tools import * # noqa | ||
from rest_framework.test import APITestCase | ||
|
||
|
@@ -19,17 +17,12 @@ def setUp(self): | |
|
||
def test_link_terms_no_input(self): | ||
response = self.client.post('/api/documents/1/analysis/link-terms', { | ||
'document': {}, | ||
}) | ||
assert_equal(response.status_code, 400) | ||
|
||
def test_link_terms(self): | ||
response = self.client.post('/api/documents/1/analysis/link-terms', { | ||
'document': { | ||
'frbr_uri': '/za/act/1992/1', | ||
'expression_date': '2001-01-01', | ||
'language': 'eng', | ||
'content': document_fixture(xml=""" | ||
'xml': document_fixture(xml=""" | ||
<section id="section-1"> | ||
<num>1.</num> | ||
<heading>Definitions and interpretation</heading> | ||
|
@@ -64,37 +57,83 @@ def test_link_terms(self): | |
</content> | ||
</subsection> | ||
</section> | ||
""") | ||
} | ||
"""), | ||
'language': 'eng', | ||
'provision_eid': "" | ||
}) | ||
assert_equal(response.status_code, 200) | ||
|
||
content = response.data['document']['content'] | ||
content = response.data['xml'] | ||
|
||
assert_true(content.startswith('<akomaNtoso')) | ||
assert_in('<def ', content) | ||
assert_in('<TLCTerm ', content) | ||
|
||
def test_link_terms_portion(self): | ||
response = self.client.post('/api/documents/1/analysis/link-terms', { | ||
'xml': portion_fixture(xml=""" | ||
<section id="section-1"> | ||
<num>1.</num> | ||
<heading>Definitions and interpretation</heading> | ||
<subsection id="section-1.subsection-0"> | ||
<content> | ||
<p>In these By-laws, any word or expression that has been defined in the National Road Traffic Act, 1996 (Act No. 93 of 1996) has that meaning and, unless the context otherwise indicates –</p> | ||
</content> | ||
</subsection> | ||
<subsection id="section-1.subsection-1"> | ||
<content> | ||
<blockList id="section-1.subsection-1.list1"> | ||
<listIntroduction>"authorised official" means –</listIntroduction> | ||
<item id="section-1.subsection-1.list1.a"> | ||
<num>(a)</num> | ||
<p>a member of the Johannesburg Metropolitan Police established in terms of section 64A of the South African Police Service Act, 1995 (Act No. 68 of 1995); or</p> | ||
</item> | ||
<item id="section-1.subsection-1.list1.b"> | ||
<num>(b)</num> | ||
<p>any person or official authorised as such, in writing, by the Council;</p> | ||
</item> | ||
</blockList> | ||
</content> | ||
</subsection> | ||
<subsection id="section-1.subsection-2"> | ||
<content> | ||
<p>"backfill" means to replace the structural layers, including the base, sub-base, sudgrade and subgrade but excluding the surfacing, in a trench dug in, or other excavation of, a road reserve, and “backfilling” is construed accordingly;</p> | ||
</content> | ||
</subsection> | ||
<subsection id="section-1.subsection-3"> | ||
<content> | ||
<p>"these By-Laws" includes the schedules;</p> | ||
</content> | ||
</subsection> | ||
</section> | ||
"""), | ||
'language': 'eng', | ||
'provision_eid': "sec_1" | ||
}) | ||
assert_equal(response.status_code, 200) | ||
|
||
content = response.data['xml'] | ||
|
||
assert_true(content.startswith('<portion ')) | ||
# definitions aren't found, only linked, in provision mode | ||
|
||
def test_link_terms_no_perms(self): | ||
self.client.logout() | ||
self.assertTrue(self.client.login(username='[email protected]', password='password')) | ||
user = User.objects.get(username='[email protected]') | ||
|
||
data = { | ||
'document': { | ||
'frbr_uri': '/za/act/1992/1', | ||
'expression_date': '2001-01-01', | ||
'language': 'eng', | ||
'content': document_fixture(xml=""" | ||
'xml': document_fixture(xml=""" | ||
<section id="section-1"> | ||
<num>1.</num> | ||
<heading>Definitions and interpretation</heading> | ||
<content> | ||
<p>test</p> | ||
</content> | ||
</section> | ||
""") | ||
} | ||
"""), | ||
'language': 'eng', | ||
'provision_eid': "" | ||
} | ||
|
||
# user doesn't have perms | ||
|
Oops, something went wrong.