def test_show_networking_action_admin(self): """Test that admins can get status""" self.auth_backend.set_project(self.runway) self.auth_backend.set_admin(True) response = json.loads(api.show_networking_action(self.status_id)) assert response == {'status': 'PENDING', 'node': 'manhattan_node_0', 'nic': 'boot-nic', 'type': 'modify_port', 'channel': 'null', 'new_network': 'stock_int_pub'}
def test_show_networking_action_success(self): """Test that project that has access to the node can run show_networking_action""" self.auth_backend.set_project(self.manhattan) response = json.loads(api.show_networking_action(self.status_id)) assert response == {'status': 'PENDING', 'node': 'manhattan_node_0', 'nic': 'boot-nic', 'type': 'modify_port', 'channel': 'null', 'new_network': 'stock_int_pub'}
def test_show_networking_action_failure(self): """Test that project with no access to node can't get the status""" self.auth_backend.set_project(self.runway) with pytest.raises(AuthorizationError): api.show_networking_action(self.status_id)