def test_GivenWordDictionary_WhenIterSecondTime_ThenCurrentIndexIsSetAtZero(self): file_mock = MagicMock() file_mock.readlines = MagicMock(return_value=WORD_LIST) word_dict = WordDictonary(file_mock) [word for word in word_dict] word_dict.__iter__() assert word_dict.current_index == 0
def test_GivenWordDictionary_WhenGetLength_ThenCurrentSizeIsReturned(self): file_mock = MagicMock() file_mock.readlines = MagicMock(return_value=WORD_LIST) word_dict = WordDictonary(file_mock) assert len(WORD_LIST) == len(word_dict)
def test_GivenWordDictionary_WhenIter_ThenAllWordAreReturned(self): file_mock = MagicMock() file_mock.readlines = MagicMock(return_value=WORD_LIST) word_dict = WordDictonary(file_mock) i = 0 for word in word_dict: assert WORD_LIST[i] == word i += 1
def do_request_with_dictionary(file_dict, host: str, **kwargs) -> None: word_dictionary = WordDictonary(file_dict) use_url_bruteforcer(word_dictionary, host, **kwargs)
def test_GivenWordDictionary_WhenItsGenerated_ThenCurrentIndexIsSetAtZero(self): file_mock = MagicMock() file_mock.readlines = MagicMock(return_value=WORD_LIST) word_dict = WordDictonary(file_mock) assert word_dict.current_index == 0
def test_GivenWordDictionary_WhenItsGenerated_ThenTheFileInParameterIsRead(self): file_mock = MagicMock() file_mock.readlines = MagicMock(return_value=WORD_LIST) word_dict = WordDictonary(file_mock) file_mock.readlines.assert_called()