def add_date_term_info(request, context): actual_now = get_default_date() used_now = get_comparison_date(request) context["actual_now_date"] = str(actual_now) context["effective_now_date"] = str(used_now) context["is_using_mock_data"] = is_using_file_dao() try: actual_term = get_term_by_date(actual_now) context["actual_now_term_year"] = actual_term.year context["actual_now_term_quarter"] = actual_term.quarter except Exception as ex: pass try: used_term = get_term_by_date(used_now) context["effective_now_term_year"] = used_term.year context["effective_now_term_quarter"] = used_term.quarter except Exception as ex: pass
def test_is_using_file_dao(self): with self.settings(RESTCLIENTS_SWS_DAO_CLASS=FDAO_SWS): self.assertTrue(is_using_file_dao()) with self.settings(RESTCLIENTS_SWS_DAO_CLASS=LDAO_SWS): self.assertFalse(is_using_file_dao())