Skip to content

Commit

Permalink
Add tests against live quetz (#2)
Browse files Browse the repository at this point in the history
* Move live tests here

* add dacite

* pin sqlalchemy for now

* correct path

* add config file

* clarify scope

* adjust scope

* adjust scope

* test something

* test something

* Abort if server couldn't start

* pls work

* switch path

* precommit

* add more live tests

* passing tests!

* path

* more live tests

* more live tests

* more live tests

* more live tests

* more live tests

* cmon

* cleanup

* sqlalchemy

* Update tests/conftest.py

Co-authored-by: Jan-Benedikt Jagusch <[email protected]>

* feedback

* Separate into mock, live, and both

* feedback

* remove sqlalchemy pin

* invalidate cache

* use cache again

* Update .github/workflows/ci.yml

Co-authored-by: Jan-Benedikt Jagusch <[email protected]>

* precommit

* remove old test file

* fix mock test

* Update .github/workflows/ci.yml

Co-authored-by: Jan-Benedikt Jagusch <[email protected]>

* sync dependencies

---------

Co-authored-by: Jan-Benedikt Jagusch <[email protected]>
  • Loading branch information
simonbohnen and janjagusch authored Mar 1, 2023
1 parent de8cb8b commit 0b113b4
Show file tree
Hide file tree
Showing 9 changed files with 601 additions and 297 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
pytest-md
pytest-emoji
- name: Install quetz
run: |
micromamba install -c conda-forge 'quetz>=0.6.1'
- name: Install quetz-client
run: |
pip install -e .
Expand Down
5 changes: 4 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ dependencies:
- sphinx
- sphinxcontrib-apidoc
- sphinx_rtd_theme
- tbump
- quetz >=0.6.1
- pytest-mock
- requests-mock
- httpx
# Runtime dependencies
- fire
- tbump
- requests
- dacite
- pip:
- git+https://github.com/jupyter-server/jupyter_releaser.git@v2
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ include_package_data = true
install_requires =
fire
requests
dacite
python_requires = >=3.8
package_dir=
=src
Expand Down
19 changes: 13 additions & 6 deletions src/quetz_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from dataclasses import dataclass
from itertools import count
from pathlib import Path
from typing import Dict, Iterator, List, Mapping, Optional, Union
from typing import Dict, Iterator, List, Optional, Union

import requests
from dacite import from_dict


@dataclass(frozen=True)
Expand All @@ -21,16 +22,22 @@ class Channel:


@dataclass(frozen=True)
class ChannelMember:
username: str
role: str
class Profile:
name: str
avatar_url: str


@dataclass(frozen=True)
class User:
id: str
username: str
profile: Mapping
profile: Profile


@dataclass(frozen=True)
class ChannelMember:
user: User
role: str


@dataclass(frozen=True)
Expand Down Expand Up @@ -91,7 +98,7 @@ def yield_channel_members(self, channel: str) -> Iterator[ChannelMember]:
response = self.session.get(url=url)
response.raise_for_status()
for member_json in response.json():
yield ChannelMember(**member_json)
yield from_dict(ChannelMember, member_json)

def yield_users(self, query: str = "", limit: int = 20) -> Iterator[User]:
url = f"{self.url}/api/paginated/users"
Expand Down
Loading

0 comments on commit 0b113b4

Please sign in to comment.