Skip to content

Commit

Permalink
tests update
Browse files Browse the repository at this point in the history
  • Loading branch information
owohappy committed Nov 22, 2024
1 parent 479debd commit 2e78c44
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 22 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ print(credentials)
{
'access_token': '<your_access_token>',
'refresh_token': '<your_refresh_token>',
'user_id': '<your_user_id>',
'cookie': '<cookie>',
}
```
Expand All @@ -62,7 +61,7 @@ print(credentials)
```python
from tgtg import TgtgClient

client = TgtgClient(access_token="<access_token>", refresh_token="<refresh_token>", user_id="<user_id>", cookie="<cookie>")
client = TgtgClient(access_token="<access_token>", refresh_token="<refresh_token>", cookie="<cookie>")

```

Expand Down Expand Up @@ -434,7 +433,6 @@ print(order)
{
"id": "<order_id>",
"item_id": "<item_id_that_was_ordered>",
"user_id": "<your_user_id>",
"state": "RESERVED",
"order_line": {
"quantity": 1,
Expand Down Expand Up @@ -483,7 +481,6 @@ print(order_status)
{
"id": "<order_id>",
"item_id": "<item_id_that_was_ordered>",
"user_id": "<your_user_id>",
"state": "RESERVED"
}
```
Expand Down
3 changes: 1 addition & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ def auth_polling_response():
urljoin(BASE_URL, AUTH_POLLING_ENDPOINT),
json={
"access_token": "an_access_token",
"refresh_token": "a_refresh_token",
"startup_data": {"user": {"user_id": 1234}},
"refresh_token": "a_refresh_token"
},
status=200,
)
Expand Down
1 change: 0 additions & 1 deletion tests/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,5 @@
tgtg_client_fake_tokens = {
"access_token": "access_token",
"refresh_token": "refresh_token",
"user_id": "user_id",
"cookie": "cookie",
}
11 changes: 0 additions & 11 deletions tests/test_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,21 +88,10 @@ def test_login_empty_fail():
TgtgClient().login()


def test_login_empty_token_fail():
with pytest.raises(TypeError):
TgtgClient(user_id=1234).login()


def test_login_empty_user_id_fail():
with pytest.raises(TypeError):
TgtgClient(access_token="test_token", refresh_token="test_refres_toekn").login()


def test_get_credentials(client):

assert client.get_credentials() == {
"access_token": "an_access_token",
"cookie": "sweet sweet cookie",
"refresh_token": "a_refresh_token",
"user_id": "user_id",
}
4 changes: 1 addition & 3 deletions tests/test_signup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ def test_signup_ok():
"login_response": {
"access_token": "an_access_token",
"refresh_token": "a_refresh_token",
"startup_data": {"user": {"user_id": 1234}},
}
},
status=200,
)
client = TgtgClient().signup_by_email(email="[email protected]")
assert client.access_token == "an_access_token"
assert client.refresh_token == "a_refresh_token"
assert client.user_id == 1234

\

def test_signup_fail():
responses.add(
Expand Down
1 change: 0 additions & 1 deletion tgtg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ def get_favorites(
data = {
"origin": {"latitude": latitude, "longitude": longitude},
"radius": radius,
"user_id": self.user_id,
"paging": {"page": page, "size": page_size},
"bucket": {"filler_type": "Favorites"},
}
Expand Down

0 comments on commit 2e78c44

Please sign in to comment.