def test_nodes_have_heading(self):
     checker_graph = get_graph(
         file_name=settings.CHECKER_DIAGNOSIS_FILE_NAME)
     node = checker_graph.node["n43n2"]
     self.assertEqual(
         node["heading"],
         u"Choose the option that best describes your debt problem")
 def test_nodes_have_description(self):
     _graph = get_graph(file_name=settings.DIAGNOSIS_FILE_NAME)
     node = _graph.node["n404"]
     self.assertEqual(
         unicode(node["description"]),
         u"<p><strong>The client has received a letter of proceedings, letter of issue or have a court date.</strong></p>\n<p>No financial assessment is required.</p>",
     )
 def test_nodes_have_subheading(self):
     _graph = get_graph(file_name=settings.DIAGNOSIS_FILE_NAME)
     node = _graph.node["n97"]
     self.assertEqual(
         node["context"]["subheading"],
         u"If a local authority is involved in taking a child into care and the applicant has received a letter of proceedings or letter of issue sent or client has a court date, a financial assessment is not required",
     )
    def handle_noargs(self, *args, **options):
        graph = get_graph(settings.CHECKER_DIAGNOSIS_FILE_NAME)
        paths = dict()

        def find_paths(nodes):
            node = nodes[-1]
            children = graph.successors(node)
            for child in children:
                find_paths(nodes + [child])
            if not children:
                path = nodes[1:]
                text = ""
                for node in path:
                    label = text_type(graph.node[node]["label"])
                    text += " - %s\n" % strip_tags(label)
                paths["/".join(path)] = text

        find_paths(["start"])

        print("%d paths in %s\n" %
              (len(paths), settings.CHECKER_DIAGNOSIS_FILE_NAME))
        for key in sorted(paths):
            print(key)
            print(paths[key])
    EligibilityCheckSerializerBase,
    PropertySerializerBase,
    PersonalDetailsSerializerBase,
    CaseSerializerBase,
    IncomeSerializerBase,
    SavingsSerializerBase,
    DeductionsSerializerBase,
    PersonSerializerBase,
    AdaptationDetailsSerializerBase,
    ThirdPartyDetailsSerializerBase,
)

from checker.models import ReasonForContacting, ReasonForContactingCategory

checker_graph = SimpleLazyObject(
    lambda: get_graph(file_name=settings.CHECKER_DIAGNOSIS_FILE_NAME))


class PropertySerializer(PropertySerializerBase):
    @property
    def errors(self):
        return super(PropertySerializer, self).errors

    class Meta(PropertySerializerBase.Meta):
        fields = ("value", "mortgage_left", "share", "id", "disputed", "main")


class IncomeSerializer(IncomeSerializerBase):
    class Meta(IncomeSerializerBase.Meta):
        fields = (
            "earnings",
 def setUp(self):
     self.graph = get_graph(file_name=settings.ORIGINAL_DIAGNOSIS_FILE_NAME)
     call_command('loaddata', 'initial_category')
 def setUp(self):
     self.graph = get_graph(file_name=settings.DIAGNOSIS_FILE_NAME)
     self.checker_graph = get_graph(
         file_name=settings.CHECKER_DIAGNOSIS_FILE_NAME)
     call_command("loaddata", "initial_category")
     call_command("loaddata", "initial_mattertype")