Add tests for SelfPost

This commit is contained in:
Serene-Arc
2021-02-28 09:40:42 +10:00
committed by Ali Parlakci
parent b699639b5c
commit be68d4eb1c
3 changed files with 31 additions and 4 deletions

View File

@@ -43,10 +43,13 @@ class Resource:
content = self.retry_download(self.url, 0)
if content:
self.content = content
self.hash = hashlib.md5(self.content)
self.create_hash()
else:
raise BulkDownloaderException('Could not download resource')
def create_hash(self):
self.hash = hashlib.md5(self.content)
def _determine_extension(self) -> str:
extension_pattern = r'.*(\..{3,5})$'
match = re.search(extension_pattern, self.url)