def test_all_testfiles_one_valid_file(self, os_listdir, os_exists): os_exists.return_value = True os_listdir.return_value = ["foo", "bar.md"] expected = ["bar.md"] result = list(loading.all_testfiles('/root')) self.assertEquals(result, expected)
def test_all_testfiles_dir_does_not_exist(self, os_exists): os_exists.return_value = False expected = [] result = loading.all_testfiles('/root') self.assertEquals(result, expected)
def test_all_testfiles_invalid_files(self, os_listdir, os_exists): os_exists.return_value = True os_listdir.return_value = ["foo"] expected = [] result = list(loading.all_testfiles('/root')) os_listdir.assert_called_once_with self.assertEquals(result, expected)