-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration tests for Pytvzhen APIs.
- Loading branch information
Showing
6 changed files
with
100 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"OUTPUT_PATH": "./output", | ||
"REMOVE_BACKGROUND_MUSIC_TORCH_DEVICE": "cpu", | ||
"REMOVE_BACKGROUND_MUSIC_BASELINE_MODEL_PATH": "./models/baseline.pth" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import os | ||
import unittest | ||
import tempfile | ||
|
||
from app import app | ||
|
||
|
||
class PytvzhenAPITest(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.test_dir = tempfile.mkdtemp() | ||
|
||
app.config['OUTPUT_PATH'] = self.test_dir | ||
app.config['DEBUG'] = True | ||
|
||
self.app = app.test_client() | ||
self.app.testing = True | ||
|
||
def test_download_yt_video_with_valid_video_id(self): | ||
print("download to " + self.test_dir) | ||
response = self.app.post("/yt_download", json={'video_id': 'VwhT-P3pLJs'}) | ||
assert response.status_code == 200 | ||
assert os.path.isfile(os.path.join(self.test_dir, 'VwhT-P3pLJs.mp4')) | ||
|
||
def tearDown(self): | ||
for root, dirs, files in os.walk(self.test_dir, topdown=False): | ||
for name in files: | ||
os.remove(os.path.join(root, name)) | ||
for name in dirs: | ||
os.rmdir(os.path.join(root, name)) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters