root / db / tests.py @ 8d97deff
History | View | Annotate | Download (950 Bytes)
1 |
#
|
---|---|
2 |
# Unit Tests for db
|
3 |
#
|
4 |
# Provides automated tests for db module
|
5 |
#
|
6 |
# Copyright 2010 Greek Research and Technology Network
|
7 |
#
|
8 |
|
9 |
from db.models import * |
10 |
|
11 |
from django.test import TestCase |
12 |
|
13 |
|
14 |
class FlavorTestCase(TestCase): |
15 |
fixtures = [ 'db_test_data' ]
|
16 |
|
17 |
def test_flavor(self): |
18 |
"""Test a flavor object, its internal cost calculation and naming methods"""
|
19 |
flavor = Flavor.objects.get(pk=30000)
|
20 |
|
21 |
# test current active/inactive costs
|
22 |
c_active = flavor.current_cost_active |
23 |
c_inactive = flavor.current_cost_inactive |
24 |
|
25 |
self.assertEqual(c_active, 10, 'flavor.cost_active should be 10! (%d)' % (c_active,)) |
26 |
self.assertEqual(c_inactive, 5, 'flavor.cost_inactive should be 5! (%d)' % (c_inactive,)) |
27 |
|
28 |
# test name property, should be C1R1024D10
|
29 |
f_name = flavor.name |
30 |
|
31 |
self.assertEqual(f_name, 'C1R1024D10', 'flavor.name is not generated correctly, C1R1024D10! (%s)' % (f_name,)) |
32 |
|
33 |
|
34 |
|
35 |
|