Skip to content

Commit

Permalink
Add new status pre-liquidated to DataCenterAssetStatus (#3062)
Browse files Browse the repository at this point in the history
  • Loading branch information
xliiv committed May 10, 2017
1 parent c4fc820 commit b0f9bdd
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/ralph/data_center/migrations/0025_auto_20170510_1122.py
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models
import ralph.lib.transitions.fields


class Migration(migrations.Migration):

dependencies = [
('data_center', '0024_auto_20170331_1341'),
]

operations = [
migrations.AlterField(
model_name='datacenterasset',
name='status',
field=ralph.lib.transitions.fields.TransitionField(default=1, choices=[(1, 'new'), (2, 'in use'), (3, 'free'), (4, 'damaged'), (5, 'liquidated'), (6, 'to deploy'), (7, 'cleaned'), (8, 'pre liquidated')]),
),
]
1 change: 1 addition & 0 deletions src/ralph/data_center/models/choices.py
Expand Up @@ -13,6 +13,7 @@ class DataCenterAssetStatus(Choices):
liquidated = _('liquidated')
to_deploy = _('to deploy')
cleaned = _('cleaned')
pre_liquidated = _("pre liquidated")


class Orientation(Choices):
Expand Down
17 changes: 17 additions & 0 deletions src/ralph/data_center/tests/test_models.py
Expand Up @@ -493,3 +493,20 @@ def setUp(self):

def test_masters(self):
self.assertEqual(self.cluster_1.masters, [self.master])


class TestDataCenterAssetStatuses(RalphTestCase):
def test_status_ids_are_consistent(self):
"""
Tests that adding choice keeps ids the same (choices should be
appended)
"""
statuses = DataCenterAssetStatus()
self.assertEqual(
statuses,
[
(1, 'new'), (2, 'in use'), (3, 'free'), (4, 'damaged'),
(5, 'liquidated'), (6, 'to deploy'), (7, 'cleaned'),
(8, 'pre liquidated')
]
)
2 changes: 1 addition & 1 deletion src/ralph/data_importer/tests/test_demo_data.py
Expand Up @@ -10,6 +10,6 @@ class DemoDataTestCase(TestCase):

def test_demo_data_command(self):
management.call_command('demodata')
self.assertEqual(DataCenterAsset.objects.count(), 382)
self.assertEqual(DataCenterAsset.objects.count(), 422)
self.assertEqual(BackOfficeAsset.objects.count(), 224)
self.assertEqual(get_user_model().objects.count(), 33)

0 comments on commit b0f9bdd

Please sign in to comment.