Beispiel #1
0
    def test_success_case(self):
        """ Tests that the update method works as expected """
        tm = TestModel.create(count=8, text='123456789')
        tm2 = tm.update(count=9)

        tm3 = TestModel.get(tm.vid)
        assert tm2.count == 9
        assert tm3.count == 9
Beispiel #2
0
    def test_success_case(self):
        """ Tests that the update method works as expected """
        tm = TestModel.create(count=8, text='123456789')
        tm2 = tm.update(count=9)

        tm3 = TestModel.get(tm.vid)
        assert tm2.count == 9
        assert tm3.count == 9
Beispiel #3
0
    def test_reload(self):
        """ Tests that and instance's reload method does an inplace update of the instance """
        tm0 = TestModel.create(count=8, text='123456789')
        tm1 = TestModel.get(tm0.vid)
        tm1.count = 7
        tm1.save()

        tm0.reload()
        assert tm0.count == 7
Beispiel #4
0
 def test_model_deleting_works_properly(self):
     """
     Tests that an instance's delete method deletes the instance
     """
     tm = TestModel.create(count=8, text='123456789')
     vid = tm.vid
     tm.delete()
     with self.assertRaises(TestModel.DoesNotExist):
         tm2 = TestModel.get(vid)
Beispiel #5
0
    def test_reload(self):
        """ Tests that and instance's reload method does an inplace update of the instance """
        tm0 = TestModel.create(count=8, text='123456789')
        tm1 = TestModel.get(tm0.vid)
        tm1.count = 7
        tm1.save()

        tm0.reload()
        assert tm0.count == 7
Beispiel #6
0
 def test_model_deleting_works_properly(self):
     """
     Tests that an instance's delete method deletes the instance
     """
     tm = TestModel.create(count=8, text='123456789')
     vid = tm.vid
     tm.delete()
     with self.assertRaises(TestModel.DoesNotExist):
         tm2 = TestModel.get(vid)
Beispiel #7
0
    def test_model_updating_works_properly(self):
        """
        Tests that subsequent saves after initial model creation work
        """
        tm = TestModel.create(count=8, text='123456789')

        tm.count = 100
        tm.save()

        tm.count = 80
        tm.save()

        tm.count = 60
        tm.save()

        tm.count = 40
        tm.save()

        tm.count = 20
        tm.save()

        tm2 = TestModel.get(tm.vid)
        self.assertEquals(tm.count, tm2.count)
Beispiel #8
0
    def test_model_updating_works_properly(self):
        """
        Tests that subsequent saves after initial model creation work
        """
        tm = TestModel.create(count=8, text='123456789')

        tm.count = 100
        tm.save()

        tm.count = 80
        tm.save()

        tm.count = 60
        tm.save()

        tm.count = 40
        tm.save()

        tm.count = 20
        tm.save()

        tm2 = TestModel.get(tm.vid)
        self.assertEquals(tm.count, tm2.count)
Beispiel #9
0
 def test_unicode_io(self):
     """
     Tests that unicode is saved and retrieved properly
     """
     tm1 = TestModel.create(count=9, text=u'4567ë9989')
     tm2 = TestModel.get(tm1.vid)
Beispiel #10
0
 def test_unicode_io(self):
     """
     Tests that unicode is saved and retrieved properly
     """
     tm1 = TestModel.create(count=9, text=u'4567ë9989')
     tm2 = TestModel.get(tm1.vid)