gva/gnuviechadmin/hostingpackages/tests/test_models.py
Jan Dittberner 3d18392b67 Fix tests for Python 3
- drop Python 2 __future__ imports
- fix tests to handle new Django and Python 3 module names
- reformat changed files with black
2019-01-30 21:27:25 +01:00

28 lines
843 B
Python

"""
Test for models.
"""
from django.test import TestCase
from hostingpackages.models import DISK_SPACE_UNITS, CustomerHostingPackage
class CustomerHostingPackageTest(TestCase):
def test_get_disk_space_bytes(self):
package = CustomerHostingPackage(
diskspace=10, diskspace_unit=DISK_SPACE_UNITS.G
)
self.assertEqual(package.get_disk_space(), 10 * 1024 ** 3)
def test_get_disk_space_mib(self):
package = CustomerHostingPackage(
diskspace=10, diskspace_unit=DISK_SPACE_UNITS.G
)
self.assertEqual(package.get_disk_space(DISK_SPACE_UNITS.M), 10 * 1024)
def test_get_quota(self):
package = CustomerHostingPackage(
diskspace=256, diskspace_unit=DISK_SPACE_UNITS.M
)
self.assertEqual(package.get_quota(), (262144, 275251))