Projet

Général

Profil

0001-misc-accept-link-cells-with-just-an-anchor-as-valid-.patch

Frédéric Péters, 11 mars 2020 11:29

Télécharger (1,42 ko)

Voir les différences:

Subject: [PATCH] misc: accept link cells with just an anchor as valid (#40644)

 combo/data/models.py | 4 ++++
 tests/test_cells.py  | 5 +++++
 2 files changed, 9 insertions(+)
combo/data/models.py
1104 1104
            self.mark_as_valid()
1105 1105
            return
1106 1106
        if not self.url:
1107
            if self.anchor:
1108
                # link to anchor on same page, ok.
1109
                self.mark_as_valid()
1110
                return
1107 1111
            self.mark_as_invalid('data_url_not_defined')
1108 1112
            return
1109 1113

  
tests/test_cells.py
159 159
    assert validity_info.invalid_reason_code == 'data_url_not_defined'
160 160
    assert validity_info.invalid_since is not None
161 161

  
162
    # no link defined but anchor set
163
    cell.anchor = 'plop'
164
    cell.save()
165
    assert ValidityInfo.objects.exists() is False
166

  
162 167
    # internal link - no check
163 168
    cell.link_page = page
164 169
    with mock.patch('combo.data.models.requests.get') as requests_get:
165
-