Skip to content

Commit

Permalink
Add vendor contract number and leasing rate
Browse files Browse the repository at this point in the history
  • Loading branch information
hipek8 committed Feb 20, 2024
1 parent c165df3 commit 3b39420
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/ralph/data_center/models/physical.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,17 @@ class DataCenterAsset(
choices=Orientation(),
default=Orientation.front.id,
)
vendor_contract_number = models.CharField(
null=True,
blank=True,
max_length=256,
verbose_name=_('Vendor contract number'),
)
leasing_rate = models.FloatField(
null=True,
blank=True,
verbose_name=_('Vendor contact number'),
)
slot_no = models.CharField(
blank=True,
help_text=_('Fill it if asset is blade server'),
Expand Down
14 changes: 14 additions & 0 deletions src/ralph/data_center/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,20 @@ def test_patch_data_center_asset(self):
self.assertTrue(self.dc_asset.force_depreciation)
self.assertEqual(self.dc_asset.tags.count(), 1)

def test_update_vendor_contract_number_and_leasing_rate(self):
url = reverse('datacenterasset-detail', args=(self.dc_asset.id,))
hostname = self.dc_asset.hostname
data = {
'vendor_contract_number': 'abc-123',
'leasing_rate': 123.45
}
response = self.client.patch(url, data, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.dc_asset.refresh_from_db()
self.assertEqual(self.dc_asset.hostname, hostname)
self.assertEqual(self.dc_asset.vendor_contract_number, 'abc-123')
self.assertEqual(self.dc_asset.leasing_rate, 123.45)

def test_filter_by_configuration_path(self):
url = reverse('datacenterasset-list') + '?configuration_path={}'.format(
self.dc_asset.configuration_path.path,
Expand Down

0 comments on commit 3b39420

Please sign in to comment.