Example #1
0
    def test_urls_storage_write_new_urls_twice_duplicated(self):
        base_url = 'http://podcast-site.com/'
        urls_storage = UrlsStorage(base_url)

        new_urls = [
            'http://podcast-site.com/page/1',
        ]
        urls_storage.write(new_urls)
        assert urls_storage == [
            'http://podcast-site.com/',
            'http://podcast-site.com/page/1',
        ]

        new_urls = [
            'http://podcast-site.com/page/2',
            'http://podcast-site.com/page/2',
            'http://podcast-site.com/page/3',
            'http://podcast-site.com/page/3',
            'http://podcast-site.com/page/3',
        ]
        urls_storage.write(new_urls)
        assert urls_storage == [
            'http://podcast-site.com/',
            'http://podcast-site.com/page/1',
            'http://podcast-site.com/page/2',
            'http://podcast-site.com/page/3',
        ]
Example #2
0
 def test_urls_storage_write_new_urls_blank_value(self):
     base_url = 'http://podcast-site.com/'
     urls_storage = UrlsStorage(base_url)
     new_urls = ['', None]
     urls_storage.write(new_urls)
     assert urls_storage == ['http://podcast-site.com/']
Example #3
0
 def test_urls_storage_write_validation_only_domain(self):
     base_url = 'http://podcast-site.com/'
     urls_storage = UrlsStorage(base_url)
     urls_storage.write('wrong-url.ru')
     assert urls_storage == ['http://podcast-site.com/']
Example #4
0
 def test_urls_storage_write_validation_wrong_url(self):
     base_url = 'http://podcast-site.com/'
     urls_storage = UrlsStorage(base_url)
     for url in ['wrong url', '123 456 789', 'test url for validation']:
         urls_storage.write(url)
     assert urls_storage == ['http://podcast-site.com/']
Example #5
0
 def test_urls_storage_write_validation_blank_url(self):
     base_url = 'http://podcast-site.com/'
     urls_storage = UrlsStorage(base_url)
     urls_storage.write('')
     assert urls_storage == ['http://podcast-site.com/']