Get files in local directory
This commit is contained in:
parent
68d37afec7
commit
eac6deee1d
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import os, sys
|
||||
|
||||
import bs4
|
||||
|
||||
|
@ -48,6 +48,9 @@ def get_garden_filenames(browser):
|
|||
|
||||
return titles
|
||||
|
||||
def get_local_filenames(directory):
|
||||
return os.listdir(directory)
|
||||
|
||||
def main(email, password):
|
||||
browser = initialize_webdriver()
|
||||
navigate_to_filegarden(browser)
|
||||
|
|
|
@ -114,6 +114,17 @@ class TestJardin(unittest.TestCase):
|
|||
|
||||
self.assertEqual(filenames, ["file1.jpg", "file2.jpg"])
|
||||
|
||||
@patch("jardin.os.listdir")
|
||||
def test_get_local_filenames_gets_filenames_in_local_directory(self, mockListdir):
|
||||
mockDirectory = "/home/luser/gardenfiles/"
|
||||
mockFiles = ["file1", "file2", "file3"]
|
||||
mockListdir.return_value = mockFiles
|
||||
|
||||
localFiles = jardin.get_local_filenames(mockDirectory)
|
||||
|
||||
mockListdir.assert_called_once_with(mockDirectory)
|
||||
self.assertEqual(localFiles, mockFiles)
|
||||
|
||||
@patch("jardin.initialize_webdriver")
|
||||
@patch("jardin.navigate_to_filegarden")
|
||||
@patch("jardin.login_with_password")
|
||||
|
|
Loading…
Reference in New Issue