|
| 1 | +# Copyright 2016 F5 Networks Inc. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +# |
| 15 | + |
| 16 | +import pytest |
| 17 | + |
| 18 | + |
| 19 | +@pytest.fixture |
| 20 | +def cleaner(request, bigip): |
| 21 | + initial = bigip.sys.software.update.load() |
| 22 | + |
| 23 | + def teardown(): |
| 24 | + initial.update() |
| 25 | + request.addfinalizer(teardown) |
| 26 | + |
| 27 | + |
| 28 | +class TestUpdate(object): |
| 29 | + def test_load(self, cleaner, bigip): |
| 30 | + su = bigip.sys.software.update.load() |
| 31 | + assert su.autoCheck == 'enabled' |
| 32 | + su.refresh() |
| 33 | + assert su.autoCheck == 'enabled' |
| 34 | + |
| 35 | + def test_update_autocheck(self, cleaner, bigip): |
| 36 | + su = bigip.sys.software.update.load() |
| 37 | + su.update(autoCheck='disabled') |
| 38 | + assert su.autoCheck == 'disabled' |
| 39 | + su.update(autoCheck='enabled') |
| 40 | + assert su.autoCheck == 'enabled' |
| 41 | + |
| 42 | + def test_update_frequency(self, cleaner, bigip): |
| 43 | + frequencies = ['daily', 'monthly', 'weekly'] |
| 44 | + su = bigip.sys.software.update.load() |
| 45 | + |
| 46 | + for frequency in frequencies: |
| 47 | + su.update(frequency=frequency) |
| 48 | + assert su.frequency == frequency |
0 commit comments