def test_build_graph_by_hand(self):
        # Check that this graph is dumped identical with the auto-loaded
        # graph. Then run the tests with auto-loaded. Easier to change data.
        competition = Competition(name="comp_data_01")
        competition.created = "2012-09-18T12:12:12"

        cp_add = competition.add
        nodes = competition.nodes
        # Add riders and groups
        cp_add(Rider("staff", groups=["anyone"]))
        cp_add(Rider("admin", groups=["staff"]))
        cp_add(Rider("accounts-dept"))
        cp_add(Rider("jane", groups=["admin"]))
        cp_add(Rider("jim", groups=["admin", "accounts-dept"]))

        # Add other rider groups
        nodes["accounts-dept"].add_groups(["staff"])

        # Add ponies and groups
        cp_add(Pony("financial", groups=["anything"]))
        cp_add(Pony("share-price"))
        cp_add(Pony("accounts"))
        cp_add(Pony("salaries", groups=["accounts"]))

        # Add other pony groups
        nodes["share-price"].add_groups(["financial"])
        nodes["accounts"].add_groups(["financial"])

        # Add action

        cp_add(Action("view", groups=["action"]))
        cp_add(Action("maintain", groups=["view"]))
        cp_add(Action("market", groups=["view"]))
        cp_add(Action("edit", groups=["view"]))
        cp_add(Action("create"))
        nodes["create"].add_groups(["edit", "maintain"])

        # Add latches
        cp_add(Latch("allow jane market share-price 30"))
        cp_add(Latch("allow anyone view share-price 40"))
        cp_add(Latch("deny admin view accounts 60"))
        cp_add(Latch("allow accounts-dept create accounts 70"))
        cp_add(Latch("allow jane edit salaries 85"))
        cp_add(Latch("deny accounts-dept edit salaries 85"))
        cp_add(Latch("allow jim create salaries 90"))
        cp_add(Latch("deny jane view salaries 125"))

        competition.validate()

        self.assertDictEqual(competition.dump(), TEST_COMPETITION_DICT)