Exemplo n.º 1
0
    def test_set_retries_less_than_zero(self) -> None:
        """
        Tests the method which let us set the number of retry to perform for the
        case that the given value is less than zero
        """

        given = -1
        download_helper = DownloadHelper()

        self.assertRaises(ValueError,
                          lambda: download_helper.set_retries(given))
Exemplo n.º 2
0
    def test_set_retries(self) -> None:
        """
        Tests the method which let us set the number of retry to perform.
        """

        given = 3

        expected = 3
        download_helper = DownloadHelper()

        download_helper.set_retries(given)

        actual = download_helper.retries

        self.assertEqual(expected, actual)

        download_helper = DownloadHelper(retries=given)

        actual = download_helper.retries

        self.assertEqual(expected, actual)
Exemplo n.º 3
0
    def test_set_retries_not_int(self) -> None:
        """
        Tests the method which let us set the number of retry to perform for the
        case that the given value is not a string.
        """

        given = ["Hello", "World"]

        download_helper = DownloadHelper()

        self.assertRaises(TypeError,
                          lambda: download_helper.set_retries(given))
Exemplo n.º 4
0
    def test_set_retries_return(self) -> None:
        """
        Tests the response of the method which let us set the number of retry
        to perform.
        """

        given = 3
        download_helper = DownloadHelper()

        actual = download_helper.set_retries(given)

        self.assertIsInstance(actual, DownloadHelper)