'Tests if a URL-Override clashes with a normal page url'

def test_slug_url_overwrite_clash(self):

    with self.settings(CMS_PERMISSION=False):
        create_page('home', 'nav_playground.html', 'en', published=True)
        bar = create_page('bar', 'nav_playground.html', 'en', published=False)
        foo = create_page('foo', 'nav_playground.html', 'en', published=True)
        self.assertTrue(is_valid_url(bar.get_absolute_url('en'), bar))
        self.assertTrue(is_valid_url(foo.get_absolute_url('en'), foo))
        title = foo.get_title_obj(language='en')
        title.has_url_overwrite = True
        title.path = '/bar/'
        title.save()
        foo.publish('en')
        try:
            url = is_valid_url(bar.get_absolute_url('en'), bar)
        except ValidationError:
            url = False
        if url:
            bar.save()
            bar.publish('en')
        self.assertFalse(bar.is_published('en'))
