Example #1
0
    def test_license(self):
        """Test getters and setters for license."""
        mylicense = amo.LICENSE_MPL

        lic = License()
        lic.license_type = mylicense
        lic.save()
        eq_(lic.license_type, mylicense)
Example #2
0
 def test_builtin_text(self):
     """Get license text for all built-in licenses."""
     lic = License()
     for licensetype in amo.LICENSES:
         lic.license_type = licensetype
         if not licensetype.shortname:
             assert not lic.text
         else:
             assert lic.text
Example #3
0
    def test_custom_text(self):
        """Test getters and setters for custom text."""
        mytext = 'OMG'

        lic = License()
        lic.text = mytext
        lic.save()
        lic2 = License.objects.get(pk=lic.pk)
        eq_(unicode(lic2.text), mytext)
Example #4
0
    def test_defaults(self):
        lic = License()
        lic.save()
        assert lic.is_custom, 'Custom license not recognized.'
        assert lic.license_type is amo.LICENSE_CUSTOM  # default
        assert not lic.text

        lic.license_type = amo.LICENSE_MPL
        assert not lic.is_custom, 'Built-in license not recognized.'
        assert lic.text
        eq_(lic.url, amo.LICENSE_MPL.url)