-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db1d198
commit f4f9606
Showing
10 changed files
with
151 additions
and
19 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
32 changes: 32 additions & 0 deletions
32
tests/version_manager/application/test_tutor_plugin_installer.py
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,32 @@ | ||
import pytest | ||
|
||
from tests.version_manager.infrastructure.version_manager_in_memory_repository import ( | ||
VersionManagerInMemoryRepository, | ||
) | ||
from tvm.version_manager.application.tutor_plugin_installer import TutorPluginInstaller | ||
|
||
|
||
def test_should_install_the_tutor_plugin(): | ||
# Given | ||
options = ["tutor-mfe"] | ||
repository = VersionManagerInMemoryRepository() | ||
|
||
# When | ||
installer = TutorPluginInstaller(repository=repository) | ||
installer(options) | ||
|
||
# Then | ||
assert options in repository.PLUGINS_INSTALLED | ||
|
||
|
||
def test_should_fail_if_not_add_tutor_plugin(): | ||
# Given | ||
options = [] | ||
repository = VersionManagerInMemoryRepository() | ||
|
||
# When | ||
installer = TutorPluginInstaller(repository=repository) | ||
|
||
# Then | ||
with pytest.raises(Exception) as format_err: | ||
installer(options) |
34 changes: 34 additions & 0 deletions
34
tests/version_manager/application/test_tutor_plugin_uninstaller.py
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 pytest | ||
|
||
from tests.version_manager.infrastructure.version_manager_in_memory_repository import ( | ||
VersionManagerInMemoryRepository, | ||
) | ||
from tvm.version_manager.application.tutor_plugin_uninstaller import ( | ||
TutorPluginUninstaller, | ||
) | ||
|
||
|
||
def test_should_uninstall_the_tutor_plugin(): | ||
# Given | ||
options = "codejail" | ||
repository = VersionManagerInMemoryRepository() | ||
|
||
# When | ||
uninstaller = TutorPluginUninstaller(repository=repository) | ||
uninstaller(options) | ||
|
||
# Then | ||
assert options not in repository.VERSIONS_INSTALLED | ||
|
||
|
||
def test_should_fail_if_not_add_tutor_plugin(): | ||
# Given | ||
options = "tutor-mfe" | ||
repository = VersionManagerInMemoryRepository() | ||
|
||
# When | ||
uninstaller = TutorPluginUninstaller(repository=repository) | ||
|
||
# Then | ||
with pytest.raises(Exception) as format_err: | ||
uninstaller(options) |
17 changes: 17 additions & 0 deletions
17
tests/version_manager/application/test_tutor_version_enabler.py
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,17 @@ | ||
from tests.version_manager.infrastructure.version_manager_in_memory_repository import ( | ||
VersionManagerInMemoryRepository, | ||
) | ||
from tvm.version_manager.application.tutor_version_enabler import TutorVersionEnabler | ||
|
||
|
||
def test_should_enabler_the_tutor_version(): | ||
# Given | ||
version = "v1.2.3" | ||
repository = VersionManagerInMemoryRepository() | ||
|
||
# When | ||
enabler = TutorVersionEnabler(repository=repository) | ||
enabler(version=version) | ||
|
||
# Then | ||
assert version in repository.VERSIONS_INSTALLED |
12 changes: 9 additions & 3 deletions
12
tests/version_manager/application/test_tutor_version_installer.py
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
19 changes: 19 additions & 0 deletions
19
tests/version_manager/application/test_tutor_version_lister.py
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,19 @@ | ||
from tests.version_manager.infrastructure.version_manager_in_memory_repository import ( | ||
VersionManagerInMemoryRepository, | ||
) | ||
from tvm.version_manager.application.tutor_vesion_lister import TutorVersionLister | ||
|
||
|
||
def test_should_list_tutor_versions(): | ||
# Given | ||
limit = 10 | ||
list_versions = [] | ||
for version in range(limit): | ||
list_versions.append(f"v1.2.{version}") | ||
repository = VersionManagerInMemoryRepository() | ||
|
||
# When | ||
lister = TutorVersionLister(repository=repository) | ||
|
||
# Then | ||
assert list_versions == lister(limit=limit) |
19 changes: 19 additions & 0 deletions
19
tests/version_manager/application/test_tutor_version_uninstaller.py
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,19 @@ | ||
from tests.version_manager.infrastructure.version_manager_in_memory_repository import ( | ||
VersionManagerInMemoryRepository, | ||
) | ||
from tvm.version_manager.application.tutor_version_uninstaller import ( | ||
TutorVersionUninstaller, | ||
) | ||
|
||
|
||
def test_should_uninstall_the_tutor_version(): | ||
# Given | ||
version = "v1.2.4" | ||
repository = VersionManagerInMemoryRepository() | ||
|
||
# When | ||
uninstaller = TutorVersionUninstaller(repository=repository) | ||
uninstaller(version=version) | ||
|
||
# Then | ||
assert version not in repository.VERSIONS_INSTALLED |
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