def test_proposal(self): """Should find the (one) proposal that matches, or none at all""" self.expect_json_http({'documents': [ {'documentId': '1111', 'title': 'Some Title'}, {'documentId': '2222', 'frNumber': 'AAAA', 'title': 'Some Title'}, {'documentId': '3333', 'frNumber': 'BBBB', 'title': 'Some Title'} ]}) self.assertIsNone(regs_gov.proposal('docket', 'CCCC')) proposal = regs_gov.proposal('docket', 'AAAA') self.assertEqual(proposal.regs_id, '2222')
def derive_where_needed(self): """A handful of fields might be parse-able from the original XML. If we don't have values through modification, derive them here""" if not self.comments_close_on: self.comments_close_on = self.derive_closing_date() if not self.rins: self.rins = self.derive_rins() if not self.cfr_refs: self.cfr_refs = self.derive_cfr_refs() if not self.effective: self.effective = self.derive_effective_date() if not self.docket_ids: self.docket_ids = self.derive_docket_ids() supporting = self.supporting_documents needs_supporting = not supporting for docket_id in self.docket_ids: proposal = regs_gov.proposal(docket_id, self.version_id) if proposal and not self.comment_doc_id: self.comment_doc_id = proposal.regs_id if proposal and not self.primary_docket: self.primary_docket = docket_id if needs_supporting: supporting.extend(regs_gov.supporting_docs(docket_id)) self.supporting_documents = supporting