def _filter_threads_using_year(self, reportDescription, report, year): """ Previous method filter messages of a thread. this method filters therads in a report. Don't word modifyng directy the report so I retorn the JSon again """ year_int = int(year) query = ReportQueryModel(reportDescription) report_obj = ReportModel(report) for kword in query.keywords(): threats = list() for threadobj in report_obj.threads_in(kword): #print kword, ":", threadobj.year_last_msg(), ", ", year_int, threadobj.link() if threadobj.year_last_msg() > year_int: threats.append(threadobj.json()) report_obj.set_threads_to(kword, threats) return report_obj.json()
def test_json_is_the_same_that_creation(self): rm = ReportModel(Reports.asylum) self.assertEqual(Reports.asylum, rm.json())