Revision 6d6b83a3 db/tests.py
b/db/tests.py | ||
---|---|---|
49 | 49 |
self.assertEquals(user.credit, user.quota, 'User exceeded quota! (cr:%d, qu:%d)' % ( user.credit, user.quota ) ) |
50 | 50 |
|
51 | 51 |
|
52 |
class FlavorCostHistoryTestCase(unittest.TestCase): |
|
53 |
def setUp(self): |
|
54 |
"""Setup the test""" |
|
55 |
flavor = Flavor(pk=3, cpu=10, ram=10, disk=10) |
|
56 |
flavor.save() |
|
57 |
|
|
58 |
# Add the FlavorCostHistory |
|
59 |
fch = FlavorCostHistory(pk=1, cost_active=10, cost_inactive=5) |
|
60 |
fch.effective_from = date(day=01, month=01, year=2011) |
|
61 |
fch.flavor = flavor |
|
62 |
fch.save() |
|
63 |
|
|
64 |
fch = FlavorCostHistory(pk=2, cost_active=2, cost_inactive=1) |
|
65 |
fch.effective_from = date(day=01, month=01, year=2010) |
|
66 |
fch.flavor = flavor |
|
67 |
fch.save() |
|
68 |
|
|
69 |
def tearDown(self): |
|
70 |
"""Cleaning up the data""" |
|
71 |
flavor = Flavor.objects.get(pk=3) |
|
72 |
flavor.delete() |
|
73 |
|
|
74 |
def test_flavor_cost_history(self): |
|
75 |
"""Flavor Cost History unit test method""" |
|
76 |
flavor = Flavor.objects.get(pk=3) |
|
77 |
|
|
78 |
|
|
79 |
|
|
52 | 80 |
class FlavorTestCase(unittest.TestCase): |
53 | 81 |
def setUp(self): |
54 | 82 |
"""Setup the test""" |
... | ... | |
71 | 99 |
"""Cleaning up the data""" |
72 | 100 |
flavor = Flavor.objects.get(pk=1) |
73 | 101 |
flavor.delete() |
74 |
|
|
75 |
fch = FlavorCostHistory(pk=2) |
|
76 |
fch.delete() |
|
77 | 102 |
|
78 | 103 |
def test_flavor(self): |
79 | 104 |
"""Test a flavor object, its internal cost calculation and naming methods""" |
Also available in: Unified diff