-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from at-gmbh/feature/projects-fateme
Feature/projects
- Loading branch information
Showing
9 changed files
with
404 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,5 +31,6 @@ | |
ShortEmployee, | ||
Team, | ||
WorkSchedule, | ||
Project | ||
) | ||
from personio_py.client import Personio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from .apitest_shared import * | ||
from personio_py import Project | ||
|
||
|
||
@skip_if_no_auth | ||
def test_get_projects(): | ||
create_test_project(name = "test project") | ||
projects = personio.get_projects() | ||
|
||
assert len(projects)>0 | ||
assert projects[-1].name == "test project" | ||
assert projects[-1].active == False | ||
personio.delete_project(projects[-1]) | ||
|
||
|
||
@skip_if_no_auth | ||
def test_update_project(): | ||
""" | ||
Test the update of project records on the server. | ||
""" | ||
project = create_test_project(name="initial project", active=True) | ||
project.name = "updated project" | ||
updated_project = personio.update_project(project) | ||
|
||
assert updated_project.name == "updated project" | ||
|
||
project.active = False | ||
updated_project = personio.update_project(project) | ||
|
||
assert updated_project.active == False | ||
|
||
personio.delete_project(project) | ||
|
||
@skip_if_no_auth | ||
def test_delete_project_by_id(): | ||
project = create_test_project(name="delete project by id", active=True) | ||
response = personio.delete_project(project.id_) | ||
|
||
assert response.status_code == 204 | ||
|
||
@skip_if_no_auth | ||
def test_delete_project_by_project_object(): | ||
project = create_test_project(name="delete project by object", active=True) | ||
response = personio.delete_project(project) | ||
|
||
assert response.status_code == 204 | ||
|
||
def create_test_project(name: str = 'project name', active: bool = False): | ||
p = Project(name=name, active=active) | ||
project = personio.create_project(p) | ||
|
||
return project |
Oops, something went wrong.