예제 #1
0
    def test_set_url_return(self) -> None:
        """
        Tests the response of the method which let us set the url to work with.
        """

        given = "https://example.org"
        download_helper = DownloadHelper()

        actual = download_helper.set_url(given)

        self.assertIsInstance(actual, DownloadHelper)
예제 #2
0
    def test_set_url_not_str(self) -> None:
        """
        Tests the method which let us set the url to work with for the case that
        the given url is not a string.
        """

        given = ["Hello", "World"]

        download_helper = DownloadHelper()

        self.assertRaises(TypeError, lambda: download_helper.set_url(given))
예제 #3
0
    def test_set_url(self) -> None:
        """
        Tests the method which let us set the url to work with.
        """

        given = "https://example.org"

        expected = "https://example.org"
        download_helper = DownloadHelper()

        download_helper.set_url(given)

        actual = download_helper.url

        self.assertEqual(expected, actual)

        download_helper = DownloadHelper(given)

        actual = download_helper.url

        self.assertEqual(expected, actual)