-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add check in create_submission(s) for supported language. Update test…
…s to use fixtures.
- Loading branch information
1 parent
5efa149
commit 150568a
Showing
3 changed files
with
101 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import os | ||
|
||
import pytest | ||
from dotenv import load_dotenv | ||
|
||
from judge0 import clients | ||
|
||
load_dotenv() | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def atd_ce_client(): | ||
api_key = os.getenv("ATD_API_KEY") | ||
client = clients.ATDJudge0CE(api_key) | ||
return client | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def atd_extra_ce_client(): | ||
api_key = os.getenv("ATD_API_KEY") | ||
client = clients.ATDJudge0ExtraCE(api_key) | ||
return client | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def rapid_ce_client(): | ||
api_key = os.getenv("RAPID_API_KEY") | ||
client = clients.RapidJudge0CE(api_key) | ||
return client | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def rapid_extra_ce_client(): | ||
api_key = os.getenv("RAPID_API_KEY") | ||
client = clients.RapidJudge0ExtraCE(api_key) | ||
return client | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def sulu_ce_client(): | ||
api_key = os.getenv("SULU_API_KEY") | ||
client = clients.SuluJudge0CE(api_key) | ||
return client | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def sulu_extra_ce_client(): | ||
api_key = os.getenv("SULU_API_KEY") | ||
client = clients.SuluJudge0ExtraCE(api_key) | ||
return client |
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 |
---|---|---|
@@ -1,69 +1,46 @@ | ||
import os | ||
|
||
import pytest | ||
from dotenv import load_dotenv | ||
|
||
from judge0 import clients | ||
|
||
load_dotenv() | ||
|
||
|
||
def test_atd_ce_client(): | ||
api_key = os.getenv("ATD_API_KEY") | ||
DEFAULT_CLIENTS = [ | ||
"atd_ce_client", | ||
"atd_extra_ce_client", | ||
"rapid_ce_client", | ||
"rapid_extra_ce_client", | ||
"sulu_ce_client", | ||
"sulu_extra_ce_client", | ||
] | ||
|
||
client = clients.ATDJudge0CE(api_key) | ||
|
||
@pytest.mark.parametrize("client", DEFAULT_CLIENTS) | ||
def test_get_about(client, request): | ||
client = request.getfixturevalue(client) | ||
client.get_about() | ||
client.get_config_info() | ||
client.get_languages() | ||
client.get_statuses() | ||
|
||
|
||
def test_atd_extra_ce_client(): | ||
api_key = os.getenv("ATD_API_KEY") | ||
client = clients.ATDJudge0ExtraCE(api_key) | ||
|
||
client.get_about() | ||
@pytest.mark.parametrize("client", DEFAULT_CLIENTS) | ||
def test_get_config_info(client, request): | ||
client = request.getfixturevalue(client) | ||
client.get_config_info() | ||
client.get_languages() | ||
client.get_statuses() | ||
|
||
|
||
def test_rapid_ce_client(): | ||
api_key = os.getenv("RAPID_API_KEY") | ||
client = clients.RapidJudge0CE(api_key) | ||
|
||
client.get_about() | ||
client.get_config_info() | ||
@pytest.mark.parametrize("client", DEFAULT_CLIENTS) | ||
def test_get_languages(client, request): | ||
client = request.getfixturevalue(client) | ||
client.get_languages() | ||
client.get_statuses() | ||
|
||
|
||
def test_rapid_extra_ce_client(): | ||
api_key = os.getenv("RAPID_API_KEY") | ||
client = clients.RapidJudge0ExtraCE(api_key) | ||
|
||
client.get_about() | ||
client.get_config_info() | ||
client.get_languages() | ||
@pytest.mark.parametrize("client", DEFAULT_CLIENTS) | ||
def test_get_statuses(client, request): | ||
client = request.getfixturevalue(client) | ||
client.get_statuses() | ||
|
||
|
||
def test_sulu_ce_client(): | ||
api_key = os.getenv("SULU_API_KEY") | ||
client = clients.SuluJudge0CE(api_key) | ||
|
||
client.get_about() | ||
client.get_config_info() | ||
client.get_languages() | ||
client.get_statuses() | ||
|
||
@pytest.mark.parametrize("client", DEFAULT_CLIENTS) | ||
def test_is_language_supported_multi_file_submission(client, request): | ||
client = request.getfixturevalue(client) | ||
assert client.is_language_supported(89) | ||
|
||
def test_sulu_extra_ce_client(): | ||
api_key = os.getenv("SULU_API_KEY") | ||
client = clients.SuluJudge0ExtraCE(api_key) | ||
|
||
client.get_about() | ||
client.get_config_info() | ||
client.get_languages() | ||
client.get_statuses() | ||
@pytest.mark.parametrize("client", DEFAULT_CLIENTS) | ||
def test_is_language_supported_non_valid_lang_id(client, request): | ||
client = request.getfixturevalue(client) | ||
assert not client.is_language_supported(-1) |