Implement initialize_webdriver

This commit is contained in:
The Magician 2023-10-19 21:00:07 +01:00
parent 3f00a144b4
commit 2efa292117
2 changed files with 15 additions and 3 deletions

10
jardin.py Normal file → Executable file
View File

@ -1,5 +1,12 @@
#!/usr/bin/python3
from selenium import webdriver
def initialize_webdriver():
return webdriver.Firefox()
def main(): def main():
# Initialize webdriver driver = initialize_webdriver()
# Open browser # Open browser
# Navigate to filegarden # Navigate to filegarden
# Go To Your Garden # Go To Your Garden
@ -8,7 +15,6 @@ def main():
# 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
print("Hello, world")
if __name__ == "__main__": if __name__ == "__main__":
main() main()

View File

@ -7,10 +7,16 @@ import jardin
class TestJardin(unittest.TestCase): class TestJardin(unittest.TestCase):
@patch("selenium.webdriver.Firefox") @patch("selenium.webdriver.Firefox")
def test_initialize_webdriver(self, mockFirefox): def test_initialize_webdriver_calls_Firefox(self, mockFirefox):
jardin.initialize_webdriver() jardin.initialize_webdriver()
mockFirefox.assert_called_once() mockFirefox.assert_called_once()
@patch("jardin.initialize_webdriver")
def test_main_calls_initialize_webdriver(self, mockInitializeWebdriver):
jardin.main()
mockInitializeWebdriver.assert_called_once()
if __name__ == "__main__": if __name__ == "__main__":
unittest.main() unittest.main()