Call login code

This commit is contained in:
The Magician 2023-10-20 12:52:58 +01:00
parent c4e08faa16
commit fd77e2075a
2 changed files with 20 additions and 10 deletions

View File

@ -1,5 +1,7 @@
#!/usr/bin/python3 #!/usr/bin/python3
import sys
from selenium import webdriver from selenium import webdriver
from selenium.webdriver.common.by import By from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.keys import Keys
@ -29,15 +31,15 @@ def login_with_password(browser, email, password):
click_password_button(browser) click_password_button(browser)
input_password(browser, password) input_password(browser, password)
def main(): def main(email, password):
with initialize_webdriver() as browser: browser = initialize_webdriver()
navigate_to_filegarden(browser) navigate_to_filegarden(browser)
# Go To Your Garden login_with_password(browser, email, password)
# Log in (email)
# Go To Your Garden # Go To Your Garden
# Get list of filenames in File Garden # Get list of filenames in File Garden
# Get list of files in target upload directory that don't exist in File Garden (test based on filename? size? file contents?) # Get list of files in target upload directory that don't exist in File Garden (test based on filename? size? file contents?)
# For each file in the second list, go through the file upload process # For each file in the second list, go through the file upload process
browser.close()
if __name__ == "__main__": if __name__ == "__main__":
main() main(sys.argv[1], sys.argv[2])

View File

@ -68,13 +68,21 @@ class TestJardin(unittest.TestCase):
@patch("jardin.initialize_webdriver") @patch("jardin.initialize_webdriver")
@patch("jardin.navigate_to_filegarden") @patch("jardin.navigate_to_filegarden")
@patch("jardin.login_with_password")
def test_main_calls_methods_in_correct_order(self, def test_main_calls_methods_in_correct_order(self,
mockInitializeWebdriver, mockLoginWithPassword,
mockNavigateToFilegarden): mockNavigateToFilegarden,
jardin.main() mockInitializeWebdriver):
mockEmail = "email@mail.com"
mockPassword = "p4$$w0rd"
jardin.main(mockEmail, mockPassword)
mockInitializeWebdriver.assert_called_once() mockInitializeWebdriver.assert_called_once()
mockNavigateToFilegarden.assert_called_once() mockNavigateToFilegarden.assert_called_once_with(mockInitializeWebdriver.return_value)
mockLoginWithPassword.assert_called_once_with(mockInitializeWebdriver.return_value, mockEmail, mockPassword)
mockInitializeWebdriver.return_value.close.assert_called_once()
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()