Browse Source

[MNT] modify details in client tests

tags/v0.3.2
Gene 2 years ago
parent
commit
ec8ffb1f27
5 changed files with 29 additions and 17 deletions
  1. +15
    -3
      tests/test_learnware_client/test_all_learnware.py
  2. +0
    -4
      tests/test_learnware_client/test_check_learnware.py
  3. +0
    -4
      tests/test_learnware_client/test_load_conda.py
  4. +0
    -4
      tests/test_learnware_client/test_load_docker.py
  5. +14
    -2
      tests/test_learnware_client/test_upload.py

+ 15
- 3
tests/test_learnware_client/test_all_learnware.py View File

@@ -1,4 +1,5 @@
import os
import json
import unittest
import tempfile

@@ -9,9 +10,20 @@ from learnware.specification import Specification
class TestAllLearnware(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUpClass()
email = "liujd@lamda.nju.edu.cn"
token = "f7e647146a314c6e8b4e2e1079c4bca4"

dir_path = os.path.dirname(__file__)
config_path = os.path.join(dir_path, "config.json")
if not os.path.exists(config_path):
data = {"email": None, "token": None}
with open(config_path, "w") as file:
json.dump(data, file)

with open(config_path, "r") as file:
data = json.load(file)
email = data["email"]
token = data["token"]

if email is None or token is None:
raise ValueError("Please set email and token in config.json.")
self.client = LearnwareClient()
self.client.login(email, token)



+ 0
- 4
tests/test_learnware_client/test_check_learnware.py View File

@@ -9,11 +9,7 @@ from learnware.client import LearnwareClient
class TestCheckLearnware(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUpClass()
email = "liujd@lamda.nju.edu.cn"
token = "f7e647146a314c6e8b4e2e1079c4bca4"

self.client = LearnwareClient()
self.client.login(email, token)

def test_check_learnware_pip(self):
learnware_id = "00000154"


+ 0
- 4
tests/test_learnware_client/test_load_conda.py View File

@@ -13,11 +13,7 @@ from learnware.reuse import AveragingReuser
class TestLearnwareLoad(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUpClass()
email = "liujd@lamda.nju.edu.cn"
token = "f7e647146a314c6e8b4e2e1079c4bca4"

self.client = LearnwareClient()
self.client.login(email, token)

root = os.path.dirname(__file__)
self.learnware_ids = ["00000084", "00000154", "00000155"]


+ 0
- 4
tests/test_learnware_client/test_load_docker.py View File

@@ -13,11 +13,7 @@ from learnware.reuse import AveragingReuser
class TestLearnwareLoad(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUpClass()
email = "liujd@lamda.nju.edu.cn"
token = "f7e647146a314c6e8b4e2e1079c4bca4"

self.client = LearnwareClient()
self.client.login(email, token)

root = os.path.dirname(__file__)
self.learnware_ids = ["00000084", "00000154", "00000155"]


+ 14
- 2
tests/test_learnware_client/test_upload.py View File

@@ -1,4 +1,5 @@
import os
import json
import unittest
import tempfile

@@ -8,9 +9,20 @@ from learnware.client import LearnwareClient
class TestAllLearnware(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUpClass()
email = "liujd@lamda.nju.edu.cn"
token = "f7e647146a314c6e8b4e2e1079c4bca4"
dir_path = os.path.dirname(__file__)
config_path = os.path.join(dir_path, "config.json")
if not os.path.exists(config_path):
data = {"email": None, "token": None}
with open(config_path, "w") as file:
json.dump(data, file)

with open(config_path, "r") as file:
data = json.load(file)
email = data["email"]
token = data["token"]

if email is None or token is None:
raise ValueError("Please set email and token in config.json.")
self.client = LearnwareClient()
self.client.login(email, token)



Loading…
Cancel
Save