-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sourcery refactored main branch #1
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,9 @@ def test_dashboard_createuser(page: Page) -> None: | |
medulla_connect(page) | ||
|
||
page.click("//html/body/div/div[4]/div/div[3]/div[1]/div[2]/div[1]/ul/li/a") | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=add") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=users&action=add" | ||
) | ||
Comment on lines
-22
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
|
||
|
||
|
@@ -28,7 +30,9 @@ def test_dashboard_creategroup(page: Page) -> None: | |
medulla_connect(page) | ||
|
||
page.click("//html/body/div/div[4]/div/div[3]/div[1]/div[2]/div[2]/ul/li/a") | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=add") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=groups&action=add" | ||
) | ||
Comment on lines
-31
to
+35
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
def test_create_groupe_by_dashboard_os_system(page: Page) -> None: | ||
medulla_connect(page) | ||
|
@@ -89,11 +93,17 @@ def template_create_group_by_status(page: Page, selector, group_name) -> None: | |
page.click(".edit a") | ||
expect(page).to_have_url(re.compile(".*submod=computers&action=computersgroupedit*")) | ||
|
||
page.fill("//html/body/div/div[4]/div/form/table/tbody/tr[1]/td[3]/input", "Group Created by playwright By Dashboard " + group_name) | ||
page.fill( | ||
"//html/body/div/div[4]/div/form/table/tbody/tr[1]/td[3]/input", | ||
f"Group Created by playwright By Dashboard {group_name}", | ||
) | ||
|
||
page.click(".btnPrimary[type='submit']") | ||
|
||
result_on_server = sqlcheck("dyngroup", "SELECT count(*) from Groups WHERE name = 'Group Created by playwright By Dashboard " + group_name + "'") | ||
result_on_server = sqlcheck( | ||
"dyngroup", | ||
f"SELECT count(*) from Groups WHERE name = 'Group Created by playwright By Dashboard {group_name}'", | ||
) | ||
Comment on lines
-92
to
+106
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
assert result_on_server == 1 | ||
|
||
|
@@ -103,7 +113,10 @@ def template_create_group_by_status(page: Page, selector, group_name) -> None: | |
def test_create_groupe_by_dashboard_machine_online(page: Page) -> None: | ||
medulla_connect(page) | ||
|
||
status = sqlcheck("xmppmaster", "SELECT status FROM uptime_machine WHERE hostname = '" + machineName + "' ORDER BY id DESC LIMIT 1") | ||
status = sqlcheck( | ||
"xmppmaster", | ||
f"SELECT status FROM uptime_machine WHERE hostname = '{machineName}' ORDER BY id DESC LIMIT 1", | ||
) | ||
Comment on lines
-106
to
+119
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
if(status == 1): | ||
template_create_group_by_status(page, ".computersonline-graphLabel0 a", "Machine Online") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,55 +26,73 @@ def test_open_groups(page: Page) -> None: | |
medulla_connect(page) | ||
|
||
page.click('#navbargroups') | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=index") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=groups&action=index" | ||
) | ||
Comment on lines
-29
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
|
||
def test_create_groups(page: Page) -> None: | ||
|
||
medulla_connect(page) | ||
|
||
page.click('#navbargroups') | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=index") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=groups&action=index" | ||
) | ||
|
||
page.click('#add') | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=add") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=groups&action=add" | ||
) | ||
|
||
page.fill('#groupname', TestGroup_Name) | ||
page.fill('#groupdesc', 'Description du groupe') | ||
page.click(".btnPrimary[type='submit']") | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=index") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=groups&action=index" | ||
) | ||
Comment on lines
-37
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
def test_display_groups(page: Page) -> None: | ||
|
||
medulla_connect(page) | ||
|
||
page.click('#navbargroups') | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=index") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=groups&action=index" | ||
) | ||
|
||
machine_inventory = "#g_" + TestGroup_Name + " .display a" | ||
machine_inventory = f"#g_{TestGroup_Name} .display a" | ||
page.click(machine_inventory) | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=members&group=" + TestGroup_Name) | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=groups&action=members&group={TestGroup_Name}" | ||
) | ||
Comment on lines
-52
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
|
||
def test_edit_groups(page: Page) -> None: | ||
|
||
medulla_connect(page) | ||
|
||
page.click('#navbargroups') | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=index") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=groups&action=index" | ||
) | ||
|
||
machine_inventory = "#g_" + TestGroup_Name + " .edit a" | ||
machine_inventory = f"#g_{TestGroup_Name} .edit a" | ||
page.click(machine_inventory) | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=edit&group=" + TestGroup_Name) | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=groups&action=edit&group={TestGroup_Name}" | ||
) | ||
Comment on lines
-64
to
+84
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
def test_delete_groups(page: Page) -> None: | ||
|
||
medulla_connect(page) | ||
|
||
page.click('#navbargroups') | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=groups&action=index") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=groups&action=index" | ||
) | ||
|
||
machine_inventory = "#g_" + TestGroup_Name + " .delete a" | ||
machine_inventory = f"#g_{TestGroup_Name} .delete a" | ||
Comment on lines
-75
to
+95
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
page.click(machine_inventory) | ||
page.click(".btnPrimary[type='submit']") | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,18 +36,24 @@ def test_open_users(page: Page) -> None: | |
medulla_connect(page) | ||
|
||
page.click('#navbarusers') | ||
expect(page).to_have_url( test_server + "/mmc/main.php?module=base&submod=users&action=index") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=users&action=index" | ||
) | ||
Comment on lines
-39
to
+41
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
|
||
def test_create_users(page: Page) -> None: | ||
|
||
medulla_connect(page) | ||
|
||
page.click('#navbarusers') | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=index") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=users&action=index" | ||
) | ||
|
||
page.click('#base_users_add') | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=add") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=users&action=add" | ||
) | ||
Comment on lines
-47
to
+56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
page.fill('#uid', test_user) | ||
page.fill('#pass', password) | ||
|
@@ -57,10 +63,10 @@ def test_create_users(page: Page) -> None: | |
page.fill('#title', 'title') | ||
|
||
page.click(".btnPrimary[type='submit']") | ||
|
||
# Testing if the popup is from the alert-success class and if it has the right text | ||
locator = page.locator('#__popup_container .alert.alert-success') | ||
expect(locator).to_have_text('User ' + test_user + ' successfully created') | ||
expect(locator).to_have_text(f'User {test_user} successfully created') | ||
|
||
def test_edit_users_empty(page: Page) -> None: | ||
""" | ||
|
@@ -70,9 +76,13 @@ def test_edit_users_empty(page: Page) -> None: | |
medulla_connect(page) | ||
|
||
page.click('#navbarusers') | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=index") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=users&action=index" | ||
) | ||
page.click(id_code + test_user + ' .edit') | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=edit&user=test_user") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=users&action=edit&user=test_user" | ||
) | ||
Comment on lines
-73
to
+85
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
page.click(".btnPrimary[type='submit']") | ||
|
||
time.sleep(1) | ||
|
@@ -89,9 +99,13 @@ def test_edit_users(page: Page) -> None: | |
|
||
medulla_connect(page) | ||
page.click('#navbarusers') | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=index") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=users&action=index" | ||
) | ||
page.click(id_code + test_user + ' .edit') | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=edit&user=test_user") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=users&action=edit&user=test_user" | ||
) | ||
Comment on lines
-92
to
+108
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
page.fill('#sn', 'Familly Name Edited') | ||
page.click(".btnPrimary[type='submit']") | ||
|
||
|
@@ -107,10 +121,14 @@ def test_duplicated_user(page: Page) -> None: | |
medulla_connect(page) | ||
|
||
page.click('#navbarusers') | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=index") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=users&action=index" | ||
) | ||
|
||
page.locator('#base_users_add').click() | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=add") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=users&action=add" | ||
) | ||
Comment on lines
-110
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
page.fill('#uid', test_user) | ||
page.fill('#pass', password) | ||
|
@@ -132,14 +150,16 @@ def test_delete_users(page: Page) -> None: | |
medulla_connect(page) | ||
|
||
page.click('#navbarusers') | ||
expect(page).to_have_url(test_server + "/mmc/main.php?module=base&submod=users&action=index") | ||
expect(page).to_have_url( | ||
f"{test_server}/mmc/main.php?module=base&submod=users&action=index" | ||
) | ||
page.click(id_code + test_user + ' .delete a') | ||
page.click('#delfiles') | ||
page.click(".btnPrimary[type='submit']") | ||
|
||
# Testing if the popup is from the alert-success class and if it has the right text | ||
locator = page.locator('#__popup_container .alert.alert-success') | ||
expect(locator).to_have_text('User ' + test_user + ' has been successfully deleted') | ||
expect(locator).to_have_text(f'User {test_user} has been successfully deleted') | ||
Comment on lines
-135
to
+162
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
page.click('#__popup_container button') | ||
|
||
time.sleep(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
medulla_connect
refactored with the following changes:use-fstring-for-concatenation
)