mirror of
https://github.com/altlinux/admc.git
synced 2025-01-09 17:18:15 +03:00
make a general apply_unmodified() test
add this test to all edit tests
This commit is contained in:
parent
600fca88e1
commit
0fca55f71c
@ -262,6 +262,23 @@ void ADMCTest::add_widget(QWidget *widget) {
|
||||
layout->addWidget(widget);
|
||||
}
|
||||
|
||||
// Edit should do nothing if value wasn't modified
|
||||
void ADMCTest::test_edit_apply_unmodified(AttributeEdit *edit, const QString &dn) {
|
||||
const AdObject object_before = ad.search_object(dn);
|
||||
|
||||
edit->load(ad, object_before);
|
||||
|
||||
const bool apply_success = edit->apply(ad, dn);
|
||||
QVERIFY(apply_success);
|
||||
|
||||
const AdObject object_after = ad.search_object(dn);
|
||||
|
||||
qInfo() << object_before.get_value(ATTRIBUTE_ACCOUNT_EXPIRES);
|
||||
qInfo() << object_after.get_value(ATTRIBUTE_ACCOUNT_EXPIRES);
|
||||
|
||||
QVERIFY(object_before.get_attributes_data() == object_after.get_attributes_data());
|
||||
}
|
||||
|
||||
void select_base_widget_add(SelectBaseWidget *widget, const QString &dn) {
|
||||
auto browse_button = widget->findChild<QPushButton *>();
|
||||
QVERIFY(browse_button != nullptr);
|
||||
|
@ -108,6 +108,8 @@ protected:
|
||||
// Adds a widget to layout in parent widget
|
||||
void add_widget(QWidget *widget);
|
||||
|
||||
void test_edit_apply_unmodified(AttributeEdit *edit, const QString &dn);
|
||||
|
||||
private:
|
||||
QFormLayout *layout;
|
||||
};
|
||||
|
@ -77,16 +77,8 @@ void ADMCTestCountryEdit::load() {
|
||||
QVERIFY(edit_value == test_value);
|
||||
}
|
||||
|
||||
// Edit should do nothing if value wasn't modified
|
||||
void ADMCTestCountryEdit::apply_unmodified() {
|
||||
const AdObject object_before_apply = ad.search_object(dn);
|
||||
|
||||
const bool apply_success = edit->apply(ad, dn);
|
||||
QVERIFY(apply_success);
|
||||
|
||||
const AdObject object_after_apply = ad.search_object(dn);
|
||||
|
||||
QVERIFY(object_before_apply.get_attributes_data() == object_after_apply.get_attributes_data());
|
||||
test_edit_apply_unmodified(edit, dn);
|
||||
}
|
||||
|
||||
// Edit should do change attribute to value.
|
||||
|
@ -25,6 +25,9 @@
|
||||
|
||||
#include <QDateTimeEdit>
|
||||
|
||||
// NOTE: no apply_unmodified() test because all datetime
|
||||
// attributes are read-only
|
||||
|
||||
void ADMCTestDateTimeEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
|
@ -82,6 +82,10 @@ void ADMCTestDelegationEdit::load() {
|
||||
do_test(false);
|
||||
}
|
||||
|
||||
void ADMCTestDelegationEdit::apply_unmodified() {
|
||||
test_edit_apply_unmodified(edit, dn);
|
||||
}
|
||||
|
||||
void ADMCTestDelegationEdit::apply() {
|
||||
auto do_test = [&](const bool is_on) {
|
||||
// First set current state to opposite
|
||||
|
@ -34,6 +34,7 @@ private slots:
|
||||
|
||||
void emit_edited_signal();
|
||||
void load();
|
||||
void apply_unmodified();
|
||||
void apply();
|
||||
|
||||
private:
|
||||
|
@ -80,6 +80,10 @@ void ADMCTestExpiryEdit::load() {
|
||||
QVERIFY(!end_of_check->isChecked());
|
||||
}
|
||||
|
||||
void ADMCTestExpiryEdit::apply_unmodified() {
|
||||
test_edit_apply_unmodified(edit, dn);
|
||||
}
|
||||
|
||||
void ADMCTestExpiryEdit::apply_date() {
|
||||
load();
|
||||
|
||||
|
@ -36,6 +36,7 @@ private slots:
|
||||
void edited_signal_from_check();
|
||||
void edited_signal_from_date();
|
||||
void load();
|
||||
void apply_unmodified();
|
||||
void apply_date();
|
||||
void apply_never();
|
||||
|
||||
|
@ -58,6 +58,10 @@ void ADMCTestGroupScopeEdit::load() {
|
||||
QVERIFY(combo->currentIndex() == 0);
|
||||
}
|
||||
|
||||
void ADMCTestGroupScopeEdit::apply_unmodified() {
|
||||
test_edit_apply_unmodified(edit, dn);
|
||||
}
|
||||
|
||||
void ADMCTestGroupScopeEdit::apply() {
|
||||
load();
|
||||
|
||||
|
@ -34,6 +34,7 @@ private slots:
|
||||
|
||||
void edited_signal();
|
||||
void load();
|
||||
void apply_unmodified();
|
||||
void apply();
|
||||
|
||||
private:
|
||||
|
@ -58,6 +58,10 @@ void ADMCTestGroupTypeEdit::load() {
|
||||
QVERIFY(combo->currentIndex() == 0);
|
||||
}
|
||||
|
||||
void ADMCTestGroupTypeEdit::apply_unmodified() {
|
||||
test_edit_apply_unmodified(edit, dn);
|
||||
}
|
||||
|
||||
void ADMCTestGroupTypeEdit::apply() {
|
||||
load();
|
||||
|
||||
|
@ -34,6 +34,7 @@ private slots:
|
||||
|
||||
void edited_signal();
|
||||
void load();
|
||||
void apply_unmodified();
|
||||
void apply();
|
||||
|
||||
private:
|
||||
|
@ -120,6 +120,10 @@ void ADMCTestLogonComputers::test_list_item(const int row, const QString &text)
|
||||
QVERIFY(item->text() == text);
|
||||
}
|
||||
|
||||
void ADMCTestLogonComputers::apply_unmodified() {
|
||||
test_edit_apply_unmodified(edit, dn);
|
||||
}
|
||||
|
||||
void ADMCTestLogonComputers::apply() {
|
||||
open_dialog_button->click();
|
||||
QVERIFY(QTest::qWaitForWindowExposed(dialog, 1000));
|
||||
|
@ -38,6 +38,7 @@ private slots:
|
||||
void emit_edited_signal();
|
||||
void add();
|
||||
void remove();
|
||||
void apply_unmodified();
|
||||
void apply();
|
||||
|
||||
private:
|
||||
|
@ -66,6 +66,10 @@ void ADMCTestManagerEdit::load() {
|
||||
QVERIFY(manager_display->text() == manager_dn);
|
||||
}
|
||||
|
||||
void ADMCTestManagerEdit::apply_unmodified() {
|
||||
test_edit_apply_unmodified(edit, dn);
|
||||
}
|
||||
|
||||
void ADMCTestManagerEdit::apply_after_change() {
|
||||
const AdObject object = ad.search_object(dn);
|
||||
edit->load(ad, object);
|
||||
|
@ -35,6 +35,7 @@ private slots:
|
||||
|
||||
void load_empty();
|
||||
void load();
|
||||
void apply_unmodified();
|
||||
void apply_after_change();
|
||||
void apply_after_clear();
|
||||
void properties();
|
||||
|
@ -26,6 +26,9 @@
|
||||
#include <QLineEdit>
|
||||
#include <QDateEdit>
|
||||
|
||||
// NOTE: no apply_unmodified() test because password edit
|
||||
// always changes object when applying
|
||||
|
||||
void ADMCTestPasswordEdit::init() {
|
||||
ADMCTest::init();
|
||||
|
||||
|
@ -72,16 +72,8 @@ void ADMCTestStringEdit::load() {
|
||||
QVERIFY(edit_value == test_value);
|
||||
}
|
||||
|
||||
// Edit should do nothing if value wasn't modified
|
||||
void ADMCTestStringEdit::apply_unmodified() {
|
||||
const AdObject object_before_apply = ad.search_object(dn);
|
||||
|
||||
const bool apply_success = edit->apply(ad, dn);
|
||||
QVERIFY(apply_success);
|
||||
|
||||
const AdObject object_after_apply = ad.search_object(dn);
|
||||
|
||||
QVERIFY(object_before_apply.get_attributes_data() == object_after_apply.get_attributes_data());
|
||||
test_edit_apply_unmodified(edit, dn);
|
||||
}
|
||||
|
||||
// Edit should do change attribute to value
|
||||
|
@ -107,16 +107,8 @@ void ADMCTestStringOtherEdit::load() {
|
||||
}
|
||||
}
|
||||
|
||||
// Edit should do nothing if value wasn't modified
|
||||
void ADMCTestStringOtherEdit::apply_unmodified() {
|
||||
const AdObject object_before_apply = ad.search_object(dn);
|
||||
|
||||
const bool apply_success = edit->apply(ad, dn);
|
||||
QVERIFY(apply_success);
|
||||
|
||||
const AdObject object_after_apply = ad.search_object(dn);
|
||||
|
||||
QVERIFY(object_before_apply.get_attributes_data() == object_after_apply.get_attributes_data());
|
||||
test_edit_apply_unmodified(edit, dn);
|
||||
}
|
||||
|
||||
void ADMCTestStringOtherEdit::apply_modified_main_value() {
|
||||
|
@ -77,6 +77,10 @@ void ADMCTestUnlockEdit::unchecked_after_load() {
|
||||
QVERIFY2(checkbox_is_unchecked, "Checkbox wasn't unchecked after load() call");
|
||||
}
|
||||
|
||||
void ADMCTestUnlockEdit::apply_unmodified() {
|
||||
test_edit_apply_unmodified(unlock_edit, dn);
|
||||
}
|
||||
|
||||
// Edit should do nothing if checkbox is unchecked (locked
|
||||
// user stays locked)
|
||||
void ADMCTestUnlockEdit::test_apply_unchecked() {
|
||||
|
@ -34,6 +34,7 @@ private slots:
|
||||
|
||||
void test_emit_edited_signal();
|
||||
void unchecked_after_load();
|
||||
void apply_unmodified();
|
||||
void test_apply_unchecked();
|
||||
void test_apply_checked();
|
||||
void uncheck_after_apply();
|
||||
|
@ -90,6 +90,10 @@ void ADMCTestUpnEdit::test_emit_edited() {
|
||||
QVERIFY(edited_signal_emitted);
|
||||
}
|
||||
|
||||
void ADMCTestUpnEdit::apply_unmodified() {
|
||||
test_edit_apply_unmodified(upn_edit, dn);
|
||||
}
|
||||
|
||||
// Edit should apply changes to suffix
|
||||
void ADMCTestUpnEdit::test_apply_suffix() {
|
||||
change_suffix_in_edit();
|
||||
|
@ -35,6 +35,7 @@ private slots:
|
||||
|
||||
void test_load();
|
||||
void test_emit_edited();
|
||||
void apply_unmodified();
|
||||
void test_apply_suffix();
|
||||
void test_apply_prefix();
|
||||
void test_apply_prefix_and_suffix();
|
||||
|
Loading…
Reference in New Issue
Block a user