Rack: front and rear mounting, rack settings in the page
Lint / JS (eslint) (push) Successful in 7s
Lint / Python (flake8) (push) Successful in 49s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 51s
Lint / Python (flake8) (pull_request) Successful in 55s
Test / Python Tests (pytest) (push) Successful in 1m4s
Lint / JS (eslint) (pull_request) Successful in 7s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 52s
Test / Python Tests (pytest) (pull_request) Successful in 55s
Lint / JS (eslint) (push) Successful in 7s
Lint / Python (flake8) (push) Successful in 49s
Lint / Notify on failure (push) Skipped
Lint / Deploy (push) Skipped
Security / Python Security (bandit) (push) Successful in 51s
Lint / Python (flake8) (pull_request) Successful in 55s
Test / Python Tests (pytest) (push) Successful in 1m4s
Lint / JS (eslint) (pull_request) Successful in 7s
Lint / Notify on failure (pull_request) Skipped
Lint / Deploy (pull_request) Skipped
Security / Python Security (bandit) (pull_request) Successful in 52s
Test / Python Tests (pytest) (pull_request) Successful in 55s
Items are mounted from the front, the rear, or full depth. On a 4-post rack a front and a rear item can share a unit; a full-depth one takes both sides, and the rear view shows its back. Overlaps are checked per side. Shelf contents take the shelf's side. A Front / Rear switch flips the drawing. Racks are saved in Gandalf (new cutsheet_racks table) and edited on the rack page by admins: name, height, notes, add and delete. Renaming moves the rack's items; saving the first rack carries over the items of the config default it replaces. Config racks remain the fallback. Faceplates are stretched to the full width only when the drawing is close to the slot's proportions, so the PDU is not squashed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
cd3d2f05ee
commit
c50e1f8322
11 files changed
+453
-52
No files matched your search
@@ -321,3 +321,39 @@ class TestDeviceAliases:
|
||||
def test_runs_for_the_device_include_aliased_cables(self):
|
||||
c = cable(1, ('UDM-Pro', '3'), ('Big box', 'eth0'), label='C1')
|
||||
assert [r['label'] for r in cs.runs_for('udm', [c], self.ITEMS, {})] == ['C1']
|
||||
|
||||
|
||||
class TestRackFaces:
|
||||
def _item(self, name, u, h=1, mount='front', id_=1):
|
||||
return {'id': id_, 'name': name, 'kind': 'device', 'rack_u': u, 'rack_height': h, 'mount': mount}
|
||||
|
||||
def test_front_and_rear_share_a_unit(self):
|
||||
items = [self._item('switch', 10), self._item('pdu', 10, mount='rear', id_=2)]
|
||||
front = cs.rack_layout(items, 25, 'front')
|
||||
rear = cs.rack_layout(items, 25, 'rear')
|
||||
assert [i['name'] for i in front['placed']] == ['switch'] and front['overlaps'] == []
|
||||
assert [i['name'] for i in rear['placed']] == ['pdu'] and rear['overlaps'] == []
|
||||
|
||||
def test_full_depth_takes_both_sides(self):
|
||||
items = [self._item('server', 5, 4, mount='full'), self._item('pdu', 6, mount='rear', id_=2)]
|
||||
rear = cs.rack_layout(items, 25, 'rear')
|
||||
assert [(i['name'], i['through']) for i in rear['placed']] == [('server', True)]
|
||||
assert rear['overlaps'] == [{'name': 'pdu', 'units': 'U6', 'with': ['server']}]
|
||||
front = cs.rack_layout(items, 25, 'front')
|
||||
assert [(i['name'], i['through']) for i in front['placed']] == [('server', False)]
|
||||
assert front['overlaps'] == rear['overlaps'] # reported on both faces
|
||||
|
||||
def test_mount_is_validated_and_shelf_items_take_the_shelf_side(self):
|
||||
assert cs.validate_item({'name': 'p', 'mount': 'rear', 'rack_u': 3})['mount'] == 'rear'
|
||||
assert cs.validate_item({'name': 'p'})['mount'] == 'front'
|
||||
with pytest.raises(cs.ValidationError):
|
||||
cs.validate_item({'name': 'p', 'mount': 'side'})
|
||||
shelf = {'Shelf': {'name': 'Shelf', 'kind': 'shelf'}}
|
||||
assert cs.validate_item({'name': 'm', 'shelf': 'Shelf', 'mount': 'rear'}, shelf)['mount'] == 'front'
|
||||
|
||||
def test_validate_rack(self):
|
||||
rack = cs.validate_rack({'name': ' StarTech 25U ', 'units': '25'})
|
||||
assert rack == {'name': 'StarTech 25U', 'units': 25, 'notes': ''}
|
||||
for bad in ({'name': '', 'units': 25}, {'name': 'x'}, {'name': 'x', 'units': 61}, {'name': 'x', 'units': 0}):
|
||||
with pytest.raises(cs.ValidationError):
|
||||
cs.validate_rack(bad)
|
||||
Reference in new issue
Block a user