Esempio n. 1
0
    def test_should_return_false_when_candidate_parent_is_inactive(self):
        move_date = '01-01-2019'
        new_org_uuid = self.PARENT

        self.expire_org_unit(self.PARENT)

        with self.assertRaises(exceptions.HTTPException):
            validator.is_candidate_parent_valid(self.UNIT_TO_MOVE,
                                                new_org_uuid, move_date)
Esempio n. 2
0
    def test_should_not_move_org_unit_to_child(self):
        candidate_parent = '85715fc7-925d-401b-822d-467eb4b163b6'  # Fil

        move_date = '01-02-2017'
        new_org_uuid = candidate_parent

        with self.assertRaises(exceptions.HTTPException):
            validator.is_candidate_parent_valid(self.UNIT_TO_MOVE,
                                                new_org_uuid, move_date)
Esempio n. 3
0
    def test_should_allow_move_unit_to_valid_orgtree_location(self):
        candidate_parent = 'b688513d-11f7-4efc-b679-ab082a2055d0'  # Samf

        move_date = '01-02-2017'
        new_org_uuid = candidate_parent

        # Should not raise
        validator.is_candidate_parent_valid(self.UNIT_TO_MOVE, new_org_uuid,
                                            move_date)
Esempio n. 4
0
    def test_cannot_move_unit_to_own_subtree(self):
        candidate_parent = '04c78fc2-72d2-4d02-b55f-807af19eac48'  # Frem

        move_date = '01-02-2017'
        new_org_uuid = candidate_parent

        with self.assertRaises(exceptions.HTTPException):
            validator.is_candidate_parent_valid(self.UNIT_TO_MOVE,
                                                new_org_uuid, move_date)
Esempio n. 5
0
    def test_should_not_move_root_org_unit(self):
        root_org_unit = '2874e1dc-85e6-4269-823a-e1125484dfd3'
        candidate_parent = 'b688513d-11f7-4efc-b679-ab082a2055d0'  # Samf

        move_date = '01-02-2017'
        new_org_uuid = candidate_parent

        with self.assertRaises(exceptions.HTTPException):
            validator.is_candidate_parent_valid(root_org_unit, new_org_uuid,
                                                move_date)
Esempio n. 6
0
    def test_should_not_move_org_unit_to_itself(self):
        move_date = '01-02-2017'

        with self.assertRaises(exceptions.HTTPException):
            validator.is_candidate_parent_valid(self.UNIT_TO_MOVE,
                                                self.UNIT_TO_MOVE, move_date)