Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feat/default group #106

Merged
merged 3 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions .github/workflows/fossologytests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,45 +51,3 @@ jobs:
- name: upload codecoverage results only if we are on the repository fossology/fossology-python
if: ${{ github.repository == 'fossology/fossology-python' }}
run: poetry run codecov -t ${{ secrets.CODECOV_TOKEN }}


test-last-release:
name: Integration Tests (Fossology 4.1.0)
runs-on: ubuntu-latest

container:
image: python:3.11-slim
volumes:
- /tmp:/tmp

services:
fossology:
image: fossology/fossology:4.1.0
ports:
- 8081:80
volumes:
- /tmp:/tmp

steps:
- uses: actions/checkout@v1
- name: Install host dependencies
run: |
apt-get -qq update
apt-get install -qq gcc git nmap xz-utils
rm -rf /var/lib/apt/lists/*
- name: Install Python dependencies
run: |
pip install poetry
poetry install --with=dev
- name: Install files in shared volume
run: |
tar xJf tests/files/base-files_11.tar.xz -C /tmp
- name: Check services
run: nmap fossology -p 80
- name: Run tests
run: |
poetry run coverage run --source=fossology -m pytest
poetry run coverage report -m
- name: upload codecoverage results only if we are on the repository fossology/fossology-python
if: ${{ github.repository == 'fossology/fossology-python' }}
run: poetry run codecov -t ${{ secrets.CODECOV_TOKEN }}
7 changes: 5 additions & 2 deletions fossology/obj.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ def __init__(
accessLevel: int = None,
rootFolderId: int = None,
emailNotification: str = None,
default_group: str = None,
agents: dict = None,
**kwargs,
):
Expand All @@ -278,14 +279,16 @@ def __init__(
self.accessLevel = accessLevel
self.rootFolderId = rootFolderId
self.emailNotification = emailNotification
self.default_group = default_group
self.agents = agents
self.additional_info = kwargs

def __str__(self):
return (
f"User {self.description} ({self.id}), {self.email}, "
f"access level {self.accessLevel} "
f"and root folder {self.rootFolderId}"
f"access level {self.accessLevel}, "
f"root folder {self.rootFolderId}, "
f"default group {self.default_group}"
)

@classmethod
Expand Down
14 changes: 7 additions & 7 deletions tests/test_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

# See: https://github.com/fossology/fossology/pull/2390
@pytest.mark.skip(
reason="current Fossology version has a bug, /search is not supported"
reason="current Fossology version has a bug, /search is not supported, fixed in 4.3.0"
)
def test_search_nogroup(foss: Fossology):
with pytest.raises(AuthorizationError) as excinfo:
Expand All @@ -26,15 +26,15 @@ def test_search_nogroup(foss: Fossology):


@pytest.mark.skip(
reason="current Fossology version has a bug, /search is not supported"
reason="current Fossology version has a bug, /search is not supported, fixed in 4.3.0"
)
def test_search(foss: Fossology, upload: Upload):
search_result = foss.search(searchType=SearchTypes.ALLFILES, filename="GPL%")
assert search_result


@pytest.mark.skip(
reason="current Fossology version has a bug, /search is not supported"
reason="current Fossology version has a bug, /search is not supported, fixed in 4.3.0"
)
def test_search_nothing_found(foss: Fossology, upload: Upload):
search_result = foss.search(
Expand All @@ -50,7 +50,7 @@ def test_search_nothing_found(foss: Fossology, upload: Upload):


@pytest.mark.skip(
reason="current Fossology version has a bug, /search is not supported"
reason="current Fossology version has a bug, /search is not supported, fixed in 4.3.0"
)
def test_search_directory(foss: Fossology, upload: Upload):
search_result = foss.search(
Expand All @@ -61,7 +61,7 @@ def test_search_directory(foss: Fossology, upload: Upload):


@pytest.mark.skip(
reason="current Fossology version has a bug, /search is not supported"
reason="current Fossology version has a bug, /search is not supported, fixed in 4.3.0"
)
def test_search_upload(foss: Fossology, upload: Upload):
search_result = foss.search(
Expand All @@ -73,7 +73,7 @@ def test_search_upload(foss: Fossology, upload: Upload):


@pytest.mark.skip(
reason="current Fossology version has a bug, /search is not supported"
reason="current Fossology version has a bug, /search is not supported, fixed in 4.3.0"
)
def test_search_upload_does_not_exist(foss: Fossology):
# Before 1.0.17 Fossology was not able to limit search to a specific upload
Expand All @@ -97,7 +97,7 @@ def test_search_upload_does_not_exist(foss: Fossology):


@pytest.mark.skip(
reason="current Fossology version has a bug, /search is not supported"
reason="current Fossology version has a bug, /search is not supported, fixed in 4.3.0"
)
@responses.activate
def test_search_error(foss_server: str, foss: Fossology):
Expand Down