def test_set_ntp_ok(self): resp_data = resp_datafile('set_date_and_time', 'ok') httpretty.register_uri( httpretty.POST, '%s/admin/timesynccfg' % epiphan_url, body=resp_data) response = WebUiConfig.set_ntp( client=self.c, server='north-america.pool.ntp.org', timezone='US/Alaska') assert response is True
def test_set_ntp_proto_didnot_take(self): resp_data = resp_datafile('set_date_and_time', 'proto_didnot_take') httpretty.register_uri( httpretty.POST, '%s/admin/timesynccfg' % epiphan_url, body=resp_data) with pytest.raises(SettingConfigError) as e: response = WebUiConfig.set_ntp( client=self.c, server='north-america.pool.ntp.org', timezone='US/Alaska') assert 'protocol setting expected(NTP)' in e.value.message
def test_set_ntp_invalid_tz(self): resp_data = resp_datafile('set_date_and_time', 'invalid_tz') httpretty.register_uri( httpretty.POST, '%s/admin/timesynccfg' % epiphan_url, body=resp_data) with pytest.raises(SettingConfigError) as e: response = WebUiConfig.set_ntp( client=self.c, server='north-america.pool.ntp.org', timezone='Kawabonga') assert 'Unsupported time zone' in e.value.message