Skip to content

Commit

Permalink
fix(module): remove get avatar (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fatpandac authored May 31, 2022
1 parent b2b1b43 commit 267a4de
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 38 deletions.
2 changes: 1 addition & 1 deletion sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def print_green_sentence(sentence):
def main():
# Step 1, init object
print_red_sentence("\nStep 1, init object")
print_green_sentence("core = Core(username, password)")
print_green_sentence(f"core = Core({username}, {password})")
core = Core(username, password)

# Stpe 2
Expand Down
3 changes: 0 additions & 3 deletions src/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ def __process_user_info(self) -> None:
info_res = self.__request.do_get(self.__api_url.info_api())
info_data = info_res.json()
self.__user.set_name(info_data["name"])
self.__user.set_avatar(
self.__request.get_host() + info_data["headimgurl"]
)

def login(self) -> dict:
api = self.__api_url.get_nonce_api()
Expand Down
8 changes: 0 additions & 8 deletions src/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class User:
__username = None
__pwd = None
__name = None
__avatar = None
__course_data = None
__lessons_data = None
__mcs_id = None
Expand Down Expand Up @@ -45,12 +44,6 @@ def set_name(self, name: str) -> None:
def get_name(self) -> str:
return self.__name

def set_avatar(self, avatar: str) -> None:
self.__avatar = avatar

def get_avatar(self) -> str:
return self.__avatar

def set_course_data(self, course_data: dict) -> None:
self.__course_data = course_data

Expand All @@ -76,7 +69,6 @@ def get_info(self) -> dict:
"username": self.__username,
"pwd": self.__pwd,
"name": self.__name,
"avatar": self.__avatar,
"mcs_id": self.__mcs_id,
"course_data": self.__course_data,
"lessons_data": self.__lessons_data,
Expand Down
1 change: 0 additions & 1 deletion tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def test_get_info():
assert res["xsid"] is None
assert res["id"] is None
assert res["name"] is None
assert res["avatar"] is None


def test_get_course():
Expand Down
16 changes: 0 additions & 16 deletions tests/test_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,3 @@ def test_do_get():
},
)
assert res.status_code == 200


def test_do_post():
request = Request()
res = request.do_post(
"https://sm.ms/api/v2",
headers={
"User-Agent": ua,
},
proxies={
"http": "http://127.0.0.1:8889",
"https": "http://127.0.0.1:8889",
},
)
print(res.request.headers)
assert res.status_code == 200
9 changes: 0 additions & 9 deletions tests/test_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
username = "122132421"
pwd = "123456"
name = "asad"
avatar = "/saad"
course_data = {"test"}
lessons_data = {"test"}

Expand Down Expand Up @@ -47,12 +46,6 @@ def test_get_and_set_name():
assert user.get_name() == name


def test_get_and_set_avatar():
user = User(username, pwd)
user.set_avatar(avatar)
assert user.get_avatar() == avatar


def test_get_and_set_course_data():
user = User(username, pwd)
user.set_course_data(course_data)
Expand All @@ -76,7 +69,6 @@ def test_get_info():
user.set_xsid(xsid)
user.set_id(id)
user.set_name(name)
user.set_avatar(avatar)
user.set_course_data(course_data)
user.set_lessons_data(lessons_data)
info = user.get_info()
Expand All @@ -85,6 +77,5 @@ def test_get_info():
assert info["username"] == username
assert info["pwd"] == pwd
assert info["name"] == name
assert info["avatar"] == avatar
assert info["course_data"] == course_data
assert info["lessons_data"] == lessons_data

0 comments on commit 267a4de

Please sign in to comment.