Skip to content

Commit

Permalink
General housekeeping
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelRobidas committed Jul 10, 2022
1 parent ea9c7c3 commit 9ede6b6
Show file tree
Hide file tree
Showing 32 changed files with 9,763 additions and 22,199 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ services:
- ./backups:/calcus/backups
- ./logs:/calcus/logs
- ./frontend/migrations:/calcus/frontend/migrations
- ./scripts:/calcus/scripts
links:
- redis
env_file:
Expand Down
436 changes: 222 additions & 214 deletions frontend/calcusliveserver.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions frontend/templates/frontend/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@


{% if user.profile.group != None %}
<div class="navbar-item has-dropdown is-hoverable">
<div class="navbar-item has-dropdown is-hoverable" id="navbar_group">
<a class="navbar-link">Research Group</a>
<div class="navbar-dropdown">
<a class="navbar-item" href="/projects/{{ user.profile.group.PI.username }}">{{ user.profile.group.PI.username }}</a>
Expand All @@ -211,7 +211,7 @@
</div>
{% endif %}
{% if user.profile.clusteraccess_owner.count > 0 %}
<div class="navbar-item has-dropdown is-hoverable">
<div class="navbar-item has-dropdown is-hoverable" id="navbar_accesses">
<a class="navbar-link">Cluster Accesses</a>
<div class="navbar-dropdown">
{% for a in user.profile.clusteraccess_owner.all %}
Expand Down
66 changes: 40 additions & 26 deletions frontend/test_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,16 @@ def run_daemon(self):

def test_setup(self):
self.setup_cluster()
msg = self.driver.find_element_by_id("test_msg").text
msg = self.driver.find_element(By.ID, "test_msg").text
self.assertEqual(msg, "Connected")

def setup_cluster(self):
self.lget("/profile")

try:
access = self.driver.find_element_by_css_selector(
"#owned_accesses > center > table > tbody > tr > th:nth-child(3) > a"
access = self.driver.find_element(
By.CSS_SELECTOR,
"#owned_accesses > center > table > tbody > tr > th:nth-child(3) > a",
)
except selenium.common.exceptions.NoSuchElementException:
pass
Expand Down Expand Up @@ -134,7 +135,7 @@ def test_delete_access(self):
while not main_window_handle:
main_window_handle = self.driver.current_window_handle

delete_access = self.driver.find_element_by_id("delete_access_button")
delete_access = self.driver.find_element(By.ID, "delete_access_button")
delete_access.click()

alert = Alert(self.driver)
Expand All @@ -151,25 +152,25 @@ def test_delete_access(self):
def test_cluster_settings(self):
self.lget("/profile")

adress = self.driver.find_element_by_name("cluster_address")
adress = self.driver.find_element(By.NAME, "cluster_address")
adress.send_keys("localhost")

username = self.driver.find_element_by_name("cluster_username")
username = self.driver.find_element(By.NAME, "cluster_username")
username.send_keys("cluster")

pal = self.driver.find_element_by_name("cluster_cores")
pal = self.driver.find_element(By.NAME, "cluster_cores")
pal.clear()
pal.send_keys("8")

memory = self.driver.find_element_by_name("cluster_memory")
memory = self.driver.find_element(By.NAME, "cluster_memory")
memory.clear()
memory.send_keys("10000")

password = self.driver.find_element_by_name("cluster_password")
password = self.driver.find_element(By.NAME, "cluster_password")
password.clear()
password.send_keys("Selenium")

self.driver.find_element_by_id("add_access_button").click()
self.driver.find_element(By.ID, "add_access_button").click()
element = WebDriverWait(self.driver, 10).until(
EC.presence_of_element_located((By.ID, "public_key_area"))
)
Expand All @@ -184,25 +185,25 @@ def test_cluster_settings(self):
def test_cluster_settings2(self):
self.lget("/profile")

adress = self.driver.find_element_by_name("cluster_address")
adress = self.driver.find_element(By.NAME, "cluster_address")
adress.send_keys("localhost")

username = self.driver.find_element_by_name("cluster_username")
username = self.driver.find_element(By.NAME, "cluster_username")
username.send_keys("cluster")

pal = self.driver.find_element_by_name("cluster_cores")
pal = self.driver.find_element(By.NAME, "cluster_cores")
pal.clear()
pal.send_keys("24")

memory = self.driver.find_element_by_name("cluster_memory")
memory = self.driver.find_element(By.NAME, "cluster_memory")
memory.clear()
memory.send_keys("31000")

password = self.driver.find_element_by_name("cluster_password")
password = self.driver.find_element(By.NAME, "cluster_password")
password.clear()
password.send_keys("Selenium")

self.driver.find_element_by_id("add_access_button").click()
self.driver.find_element(By.ID, "add_access_button").click()
element = WebDriverWait(self.driver, 10).until(
EC.presence_of_element_located((By.ID, "public_key_area"))
)
Expand All @@ -216,20 +217,21 @@ def test_cluster_settings2(self):

def test_connection_gui(self):
self.setup_cluster()
msg = self.driver.find_element_by_id("test_msg").text
msg = self.driver.find_element(By.ID, "test_msg").text
self.assertEqual(msg, "Connected")

self.lget("/profile/")
manage = self.driver.find_element_by_css_selector(
"#owned_accesses > center > table > tbody > tr > th:nth-child(3) > a"
manage = self.driver.find_element(
By.CSS_SELECTOR,
"#owned_accesses > center > table > tbody > tr > th:nth-child(3) > a",
)
manage.send_keys(Keys.RETURN)

element = WebDriverWait(self.driver, 10).until(
EC.text_to_be_present_in_element((By.ID, "status_box"), "Connected")
)
self.assertNotEqual(
self.driver.find_element_by_id("status_box").text.find("Connected"), -1
self.driver.find_element(By.ID, "status_box").text.find("Connected"), -1
)

def test_autoselect_resource_remote(self):
Expand All @@ -250,7 +252,9 @@ def test_autoselect_resource_remote(self):

self.lget("/launch/")

resources = self.driver.find_elements_by_css_selector("#calc_resource > option")
resources = self.driver.find_elements(
By.CSS_SELECTOR, "#calc_resource > option"
)
self.assertEqual(len(resources), 2)
self.assertEqual(resources[0].text, "Local")
self.assertTrue(resources[0].is_selected())
Expand All @@ -260,7 +264,9 @@ def test_autoselect_resource_remote(self):

self.calc_input_params(params)

resources = self.driver.find_elements_by_css_selector("#calc_resource > option")
resources = self.driver.find_elements(
By.CSS_SELECTOR, "#calc_resource > option"
)
self.assertEqual(len(resources), 2)
self.assertEqual(resources[0].text, "Local")
self.assertFalse(resources[0].is_selected())
Expand All @@ -277,7 +283,9 @@ def test_autoselect_resource_remote(self):
self.launch_ensemble_next_step()
self.wait_for_ajax()

resources = self.driver.find_elements_by_css_selector("#calc_resource > option")
resources = self.driver.find_elements(
By.CSS_SELECTOR, "#calc_resource > option"
)
self.assertEqual(len(resources), 2)
self.assertEqual(resources[0].text, "Local")
self.assertFalse(resources[0].is_selected())
Expand All @@ -303,7 +311,9 @@ def test_autoselect_resource_local(self):

self.lget("/launch/")

resources = self.driver.find_elements_by_css_selector("#calc_resource > option")
resources = self.driver.find_elements(
By.CSS_SELECTOR, "#calc_resource > option"
)
self.assertEqual(len(resources), 2)
self.assertEqual(resources[0].text, "Local")
self.assertTrue(resources[0].is_selected())
Expand All @@ -313,7 +323,9 @@ def test_autoselect_resource_local(self):

self.calc_input_params(params)

resources = self.driver.find_elements_by_css_selector("#calc_resource > option")
resources = self.driver.find_elements(
By.CSS_SELECTOR, "#calc_resource > option"
)
self.assertEqual(len(resources), 2)
self.assertEqual(resources[0].text, "Local")
self.assertTrue(resources[0].is_selected())
Expand All @@ -330,7 +342,9 @@ def test_autoselect_resource_local(self):
self.launch_ensemble_next_step()
self.wait_for_ajax()

resources = self.driver.find_elements_by_css_selector("#calc_resource > option")
resources = self.driver.find_elements(
By.CSS_SELECTOR, "#calc_resource > option"
)
self.assertEqual(len(resources), 2)
self.assertEqual(resources[0].text, "Local")
self.assertTrue(resources[0].is_selected())
Expand Down
62 changes: 31 additions & 31 deletions frontend/test_selenium.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,12 +853,12 @@ def test_load_preset(self):

self.load_preset("Test Preset")

solvent = self.driver.find_element_by_name("calc_solvent")
theory = Select(self.driver.find_element_by_id("calc_theory_level"))
func = self.driver.find_element_by_id("calc_functional")
basis_set = self.driver.find_element_by_id("calc_basis_set")
specifications = self.driver.find_element_by_id("calc_specifications")
software = self.driver.find_element_by_id("calc_software")
solvent = self.driver.find_element(By.NAME, "calc_solvent")
theory = Select(self.driver.find_element(By.ID, "calc_theory_level"))
func = self.driver.find_element(By.ID, "calc_functional")
basis_set = self.driver.find_element(By.ID, "calc_basis_set")
specifications = self.driver.find_element(By.ID, "calc_specifications")
software = self.driver.find_element(By.ID, "calc_software")

self.assertEqual(solvent.get_attribute("value"), params["solvent"])
self.assertEqual(theory.first_selected_option.text, params["theory"])
Expand Down Expand Up @@ -893,18 +893,18 @@ def test_project_preset(self):
self.click_project("My Project")
self.create_molecule_in_project()

solvent = self.driver.find_element_by_name("calc_solvent")
solvent = self.driver.find_element(By.NAME, "calc_solvent")
solvation_model = Select(
self.driver.find_element_by_name("calc_solvation_model")
self.driver.find_element(By.NAME, "calc_solvation_model")
)
solvation_radii = Select(
self.driver.find_element_by_name("calc_solvation_radii")
self.driver.find_element(By.NAME, "calc_solvation_radii")
)
theory = Select(self.driver.find_element_by_id("calc_theory_level"))
func = self.driver.find_element_by_id("calc_functional")
basis_set = self.driver.find_element_by_id("calc_basis_set")
software = self.driver.find_element_by_id("calc_software")
specifications = self.driver.find_element_by_id("calc_specifications")
theory = Select(self.driver.find_element(By.ID, "calc_theory_level"))
func = self.driver.find_element(By.ID, "calc_functional")
basis_set = self.driver.find_element(By.ID, "calc_basis_set")
software = self.driver.find_element(By.ID, "calc_software")
specifications = self.driver.find_element(By.ID, "calc_specifications")

self.assertEqual(solvent.get_attribute("value"), params["solvent"])
self.assertEqual(
Expand Down Expand Up @@ -1549,7 +1549,7 @@ def test_request_PI(self):
self.lget("/profile/")
self.apply_PI("Test group")
self.assertTrue(
self.driver.find_element_by_id("PI_application_message").text.find(
self.driver.find_element(By.ID, "PI_application_message").text.find(
"Your request has been received"
)
!= -1
Expand Down Expand Up @@ -1993,7 +1993,7 @@ def test_ensemble_second_step(self):
}
self.calc_input_params(params2)

charge = self.driver.find_element_by_name("calc_charge")
charge = self.driver.find_element(By.NAME, "calc_charge")
self.assertEqual(charge.get_attribute("value"), params["charge"])

self.calc_launch()
Expand Down Expand Up @@ -2027,7 +2027,7 @@ def test_ensemble_second_step_mult(self):
}
self.calc_input_params(params2)

mult = self.driver.find_element_by_name("calc_multiplicity")
mult = self.driver.find_element(By.NAME, "calc_multiplicity")
self.assertEqual(mult.get_attribute("value"), params["multiplicity"])

def test_structure_second_step(self):
Expand All @@ -2054,7 +2054,7 @@ def test_structure_second_step(self):
# project and charge implicit
}

charge = self.driver.find_element_by_name("calc_charge")
charge = self.driver.find_element(By.NAME, "calc_charge")
self.assertEqual(charge.get_attribute("value"), params["charge"])

self.calc_input_params(params2)
Expand Down Expand Up @@ -2277,12 +2277,12 @@ def test_default_settings_from_ensemble(self):

self.launch_ensemble_next_step()

solvent = self.driver.find_element_by_name("calc_solvent")
charge = self.driver.find_element_by_name("calc_charge")
solvent = self.driver.find_element(By.NAME, "calc_solvent")
charge = self.driver.find_element(By.NAME, "calc_charge")
solvation_model = Select(
self.driver.find_element_by_name("calc_solvation_model")
self.driver.find_element(By.NAME, "calc_solvation_model")
)
software = self.driver.find_element_by_id("calc_software")
software = self.driver.find_element(By.ID, "calc_software")

self.assertEqual(solvent.get_attribute("value"), params["solvent"])
self.assertEqual(charge.get_attribute("value"), params["charge"])
Expand Down Expand Up @@ -2314,12 +2314,12 @@ def test_default_settings_from_structure(self):

self.launch_structure_next_step()

solvent = self.driver.find_element_by_name("calc_solvent")
charge = self.driver.find_element_by_name("calc_charge")
solvent = self.driver.find_element(By.NAME, "calc_solvent")
charge = self.driver.find_element(By.NAME, "calc_charge")
solvation_model = Select(
self.driver.find_element_by_name("calc_solvation_model")
self.driver.find_element(By.NAME, "calc_solvation_model")
)
software = self.driver.find_element_by_id("calc_software")
software = self.driver.find_element(By.ID, "calc_software")

self.assertEqual(solvent.get_attribute("value"), params["solvent"])
self.assertEqual(charge.get_attribute("value"), params["charge"])
Expand Down Expand Up @@ -2351,12 +2351,12 @@ def test_default_settings_from_frame(self):
self.details_first_calc()
self.launch_frame_next_step()

solvent = self.driver.find_element_by_name("calc_solvent")
charge = self.driver.find_element_by_name("calc_charge")
solvent = self.driver.find_element(By.NAME, "calc_solvent")
charge = self.driver.find_element(By.NAME, "calc_charge")
solvation_model = Select(
self.driver.find_element_by_name("calc_solvation_model")
self.driver.find_element(By.NAME, "calc_solvation_model")
)
software = self.driver.find_element_by_id("calc_software")
software = self.driver.find_element(By.ID, "calc_software")

self.assertEqual(solvent.get_attribute("value"), params["solvent"])
self.assertEqual(charge.get_attribute("value"), params["charge"])
Expand Down Expand Up @@ -4058,7 +4058,7 @@ def test_input_file_present(self):
self.details_latest_order()
self.details_first_calc()

input_file = self.driver.find_element_by_css_selector(".textarea")
input_file = self.driver.find_element(By.CSS_SELECTOR, ".textarea")
assert len(input_file.text) > 10

def test_sp_from_frame(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ H 1.99826837 0.05502843 0.00651241
H 0.59453997 -0.48560162 0.83949232
H 0.66998094 -0.58930117 -0.87511947
*
%geom
Calc_Hess true
end
%pal
nprocs 4
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ H 1.99826837 0.05502843 0.00651241
H 0.59453997 -0.48560162 0.83949232
H 0.66998094 -0.58930117 -0.87511947
*
%geom
Calc_Hess true
end
%pal
nprocs 4
end
Loading

0 comments on commit 9ede6b6

Please sign in to comment.