Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion ietf/doc/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@

from ietf.doc.models import ( Document, DocEvent, NewRevisionDocEvent, DocAlias, State, DocumentAuthor,
StateDocEvent, BallotPositionDocEvent, BallotDocEvent, BallotType, IRSGBallotDocEvent, TelechatDocEvent,
DocumentActionHolder, BofreqEditorDocEvent, BofreqResponsibleDocEvent )
DocumentActionHolder, BofreqEditorDocEvent, BofreqResponsibleDocEvent, DocExtResource )
from ietf.group.models import Group
from ietf.person.factories import PersonFactory
from ietf.group.factories import RoleFactory
from ietf.name.models import ExtResourceName
from ietf.utils.text import xslugify
from ietf.utils.timezone import date_today



def draft_name_generator(type_id,group,n):
return '%s-%s-%s-%s%d'%(
type_id,
Expand Down Expand Up @@ -520,3 +522,12 @@ def states(obj, create, extracted, **kwargs):
obj.set_state(State.objects.get(type_id=state_type_id,slug=state_slug))
else:
obj.set_state(State.objects.get(type_id='procmaterials', slug='active'))

class DocExtResourceFactory(factory.django.DjangoModelFactory):

name = factory.Iterator(ExtResourceName.objects.filter(type_id='url'))
value = factory.Faker('url')
doc = factory.SubFactory('ietf.doc.factories.BaseDocumentFactory')
class Meta:
model = DocExtResource

5 changes: 4 additions & 1 deletion ietf/doc/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
ConflictReviewFactory, WgDraftFactory, IndividualDraftFactory, WgRfcFactory,
IndividualRfcFactory, StateDocEventFactory, BallotPositionDocEventFactory,
BallotDocEventFactory, DocumentAuthorFactory, NewRevisionDocEventFactory,
StatusChangeFactory, BofreqFactory)
StatusChangeFactory, BofreqFactory, DocExtResourceFactory)
from ietf.doc.forms import NotifyForm
from ietf.doc.fields import SearchableDocumentsField
from ietf.doc.utils import create_ballot_if_not_open, uppercase_std_abbreviated_name
Expand Down Expand Up @@ -602,6 +602,8 @@ def test_document_draft(self):
updated_by = IndividualDraftFactory()
updated_by.relateddocument_set.create(relationship_id='updates',source=obsoleted_by,target=draft.docalias.first())

external_resource = DocExtResourceFactory(doc=draft)

# these tests aren't testing all attributes yet, feel free to
# expand them

Expand All @@ -622,6 +624,7 @@ def test_document_draft(self):
self.assertNotContains(r, updated.title)
self.assertNotContains(r, updated_by.canonical_name())
self.assertNotContains(r, updated_by.title)
self.assertContains(r, external_resource.value)

r = self.client.get(urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name)) + "?include_text=0")
self.assertEqual(r.status_code, 200)
Expand Down
2 changes: 0 additions & 2 deletions ietf/templates/doc/document_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,6 @@
{% endif %}
{% endif %}
{% with doc.docextresource_set.all as resources %}
{% if document_html and resources or document_html and doc.group and doc.group.list_archive %}
{% if resources or doc.group and doc.group.list_archive or can_edit_stream_info or can_edit_individual %}
<tr>
<td>
Expand Down Expand Up @@ -443,6 +442,5 @@
</td>
</tr>
{% endif %}
{% endif %}
{% endwith %}
</tbody>