Example #1
0
 def test_solo_manager(self):
     manager = SoloManager(model_class=SampleModel)
     self.assertEqual(manager.query.count(), 0)
     manager.create(**{})
     self.assertEqual(manager.query.count(), 1)
     manager.create(**{})
     self.assertEqual(manager.query.count(), 1)
     self.assertNotEqual(manager.get_solo(), None)
Example #2
0
 def test_get_raises_ValueError_for_solo_manager(self):
     manager = SoloManager(model_class=SampleModel)
     self.assertRaises(ValueError, lambda: manager.get(id=1))
Example #3
0
 def test_get_solo_nothing_exist(self):
     manager = SoloManager(model_class=SampleModel)
     self.assertEqual(manager.query.count(), 0)
     self.assertNotEqual(manager.get_solo(), None)
     self.assertEqual(manager.query.count(), 1)