Skip to content

Commit

Permalink
fix: make factory name derivation better. Adjust status_change test
Browse files Browse the repository at this point in the history
  • Loading branch information
rjsparks committed Jul 7, 2023
1 parent 2c6fe03 commit d4f5bc6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ietf/doc/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class DocumentFactory(BaseDocumentFactory):
class RfcFactory(BaseDocumentFactory):
type_id = "rfc"
rfc_number = factory.Sequence(lambda n: n + 1000)
name = factory.LazyAttribute(lambda o: f"rfc{o.rfc_number:04d}")
name = factory.LazyAttribute(lambda o: f"rfc{o.rfc_number:d}")
expires = None

@factory.post_generation
Expand Down
15 changes: 11 additions & 4 deletions ietf/doc/tests_status_change.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from django.conf import settings
from django.urls import reverse as urlreverse

from ietf.doc.factories import DocumentFactory, IndividualRfcFactory, WgRfcFactory
from ietf.doc.factories import DocumentFactory, IndividualRfcFactory, WgRfcFactory, WgDraftFactory
from ietf.doc.models import ( Document, DocAlias, State, DocEvent,
BallotPositionDocEvent, NewRevisionDocEvent, TelechatDocEvent, WriteupDocEvent )
from ietf.doc.utils import create_ballot_if_not_open
Expand Down Expand Up @@ -449,9 +449,16 @@ def verify_relations(doc,target_name,status):

def setUp(self):
super().setUp()
IndividualRfcFactory(alias2__name='rfc14',name='draft-was-never-issued',std_level_id='unkn')
WgRfcFactory(alias2__name='rfc9999',name='draft-ietf-random-thing',std_level_id='ps')
WgRfcFactory(alias2__name='rfc9998',name='draft-ietf-random-other-thing',std_level_id='inf')
IndividualRfcFactory(rfc_number=14,std_level_id='unkn') # draft was never issued

rfc = WgRfcFactory(rfc_number=9999,std_level_id='ps')
draft = WgDraftFactory(name='draft-ietf-random-thing')
draft.relateddocument_set.create(relationship_id="became_rfc", target=rfc.docalias.first())

rfc = WgRfcFactory(rfc_number=9998,std_level_id='inf')
draft = WgDraftFactory(name='draft-ietf-random-other-thing')
draft.relateddocument_set.create(relationship_id="became_rfc", target=rfc.docalias.first())

DocumentFactory(type_id='statchg',name='status-change-imaginary-mid-review',notify='[email protected]')

class StatusChangeSubmitTests(TestCase):
Expand Down

0 comments on commit d4f5bc6

Please sign in to comment.