Пример #1
0
class TestModelLicences(TestCase):
    def setUp(self):
        self.licence = LicenceFactory()

    def test_remarks(self):
        """Remarks field is in model?"""
        self.licence.remarks = 'a' * 512
        self.licence.save()

        self.assertEqual(self.licence.remarks, 'a' * 512)

    def test_service_name(self):
        old_service = self.licence.service_name
        self.licence.service_name = ServiceFactory()
        self.licence.save()

        self.assertNotEqual(old_service, self.licence.service_name)
Пример #2
0
class TestModelLicences(TestCase):
    def setUp(self):
        self.licence = LicenceFactory()

    def test_remarks(self):
        """Remarks field is in model?"""
        self.licence.remarks = 'a' * 512
        self.licence.save()

        self.assertEqual(self.licence.remarks, 'a' * 512)

    def test_service_name(self):
        old_service = self.licence.service_name
        self.licence.service_name = ServiceFactory()
        self.licence.save()

        self.assertNotEqual(old_service, self.licence.service_name)
Пример #3
0
    def test_asset(self):
        asset = AssetFactory(pk=123)
        history = asset.get_history()
        self.assertEqual(0, history.count())

        asset.sn = '123'
        asset.save()
        self.assertEqual(1, history.count())

        asset.sn = '1233'
        asset.save()
        self.assertEqual(2, history.count())

        licence = LicenceFactory()
        history = licence.get_history()
        licence.save()
        licence.save()
        self.assertEqual(0, history.count())

        for i in xrange(5):
            asset = AssetFactory()
            licence.assets.add(asset)
            self.assertEqual(i + 1, history.count())