create system user when creating a new hosting package

This commit is contained in:
Jan Dittberner 2015-01-22 00:19:30 +01:00
parent d4f68a155c
commit 888a2463c4
6 changed files with 110 additions and 10 deletions

View file

@ -0,0 +1,31 @@
"""
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 * 1024**2)
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))