Exemplo n.º 1
0
    def test_valid_github_url(self):
        """
        Test if django persists a invalid github url.
        """

        with self.assertRaises(ValidationError):
            site = Site(
                name='Site',
                base_url='http://www.example.com/',
                github_url='https://www.w3.org/TR/WCAG20/'
            )
            site.full_clean()
            site.save()
Exemplo n.º 2
0
    def test_normal_save(self):
        """
        Test if django persist a valid site object.
        """

        site = Site(
            name='Site',
            base_url='http://www.example.com/',
            github_url='https://github.com/carlsonsantana/wapyce'
        )
        site.full_clean()
        site.save()
        self.assertEqual(site, Site.objects.all().order_by('?').first())