Example #1
0
    def test_can_change_to_readonly(self):
        tag = EventTag(name=u"test", slug=u"test", read_only=False)
        tag.save()
        pk = tag.pk

        tag = EventTag.objects.get(id=pk)
        self.assertFalse(tag.read_only)

        tag.read_only = True
        tag.save()

        tag = EventTag.objects.get(id=pk)
        self.assertTrue(tag.read_only)

        tag.name = "crispin"
        self.assertFalse(tag.save())
Example #2
0
    def test_cant_edit_most_of_readonly(self):
        tag = EventTag(name=u"test", slug=u"test", read_only=True)
        tag.save()
        pk = tag.pk
        # Try to edit:
        tag.name = "crispin"
        tag.slug = "bert"
        tag.read_only = False
        self.assertFalse(tag.save())

        tag = EventTag.objects.get(id=pk)
        # Things shouldn't change:
        self.assertEqual(tag.name, "test")
        self.assertEqual(tag.slug, "test")
        self.assertEqual(tag.promoted, False)
        self.assertEqual(tag.read_only, True)
Example #3
0
    def test_cant_edit_most_of_readonly(self):
        tag = EventTag(name=u"test", slug=u"test", read_only=True)
        tag.save()
        pk = tag.pk
        # Try to edit:
        tag.name = "crispin"
        tag.slug = "bert"
        tag.read_only = False
        self.assertFalse(tag.save())

        tag = EventTag.objects.get(id=pk)
        # Things shouldn't change:
        self.assertEqual(tag.name, "test")
        self.assertEqual(tag.slug, "test")
        self.assertEqual(tag.promoted, False)
        self.assertEqual(tag.read_only, True)
Example #4
0
    def test_can_change_to_readonly(self):
        tag = EventTag(name=u"test", slug=u"test", read_only=False)
        tag.save()
        pk = tag.pk

        tag = EventTag.objects.get(id=pk)
        self.assertFalse(tag.read_only)

        tag.read_only = True
        tag.save()

        tag = EventTag.objects.get(id=pk)
        self.assertTrue(tag.read_only)

        tag.name = "crispin"
        self.assertFalse(tag.save())
Example #5
0
    def test_can_edit_readonly_promotion(self):
        tag = EventTag(
            name=u"test", slug=u"test", read_only=True,
            sort_order=1, promoted=False)
        tag.save()
        pk = tag.pk
        # Try to edit:
        tag.name = "crispin"
        tag.promoted = True
        tag.read_only = False
        tag.sort_order = 0xF00BA
        self.assertFalse(tag.save())

        tag = EventTag.objects.get(id=pk)
        # Most things shouldn't change:
        self.assertEqual(tag.name, "test")
        self.assertEqual(tag.slug, "test")
        self.assertEqual(tag.read_only, True)
        # Promoted and sort values should:
        self.assertEqual(tag.promoted, True)
        self.assertEqual(tag.sort_order, 0xF00BA)
Example #6
0
    def test_can_edit_readonly_promotion(self):
        tag = EventTag(name=u"test",
                       slug=u"test",
                       read_only=True,
                       sort_order=1,
                       promoted=False)
        tag.save()
        pk = tag.pk
        # Try to edit:
        tag.name = "crispin"
        tag.promoted = True
        tag.read_only = False
        tag.sort_order = 0xF00BA
        self.assertFalse(tag.save())

        tag = EventTag.objects.get(id=pk)
        # Most things shouldn't change:
        self.assertEqual(tag.name, "test")
        self.assertEqual(tag.slug, "test")
        self.assertEqual(tag.read_only, True)
        # Promoted and sort values should:
        self.assertEqual(tag.promoted, True)
        self.assertEqual(tag.sort_order, 0xF00BA)