Пример #1
0
    def test_basic(self):
        m = Bit1Model()
        m.flag_a = False
        m.flag_b = True
        m.save()

        m = Bit1Model.objects.get(id=m.id)
        assert not m.flag_a
        assert m.flag_b

        m.save()

        m = Bit1Model.objects.get(id=m.id)
        assert not m.flag_a
        assert m.flag_b

        m.flag_a = True
        m.flag_b = False
        m.save()

        m = Bit1Model.objects.get(id=m.id)
        assert m.flag_a
        assert not m.flag_b
Пример #2
0
 def test_dumping(self):
     instance = Bit1Model(flag_a=True, flag_b=False)
     data = json.loads(serializers.serialize('json', [instance]))[0]
     fields = data['fields']
     assert fields['flag_a']
     assert not fields['flag_b']