Skip to content

Chapter1 #11

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 31 commits into
base: example/01_setup_python_dependencies
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
785a6c8
Added a test for read all API of people application and which makes u…
Aug 4, 2020
e72acc1
Updated README.md
Aug 4, 2020
e4a208c
Merging 01_setup_python_dependencies into master
Nov 25, 2020
edc7e8a
Added assert py into Pipfile
Nov 25, 2020
09caa48
Added test to show use of POST method to create a new person and asse…
Nov 25, 2020
ae5ac93
- Added test to show use of POST method to create a new person and as…
Nov 25, 2020
1a494c4
Showing off user of requests.codes to have readable http codes
Nov 25, 2020
ec6c3cd
Extracted create person into its own method and added test for delete…
Nov 27, 2020
342f060
Extracted search for users as a function
Nov 27, 2020
3f9fc63
Removed explicit assertion since that is already made within create u…
Nov 27, 2020
2ca9964
Replaced get methods assetions with assertpy's fluent assertion
Dec 1, 2020
657cf98
Added lxml dependency and covid_test.py to demo how to work with xml …
Dec 14, 2020
d369979
Added another test to show couple of ways we can get values from XML …
Dec 15, 2020
d2d9252
- Added a json file to store the template for a request
Dec 22, 2020
701791c
Formatted json
Dec 25, 2020
becf0d7
Added example of schema validation for Read all operation in people API
Dec 27, 2020
2ed2046
Extracted schema outside the functions and added a separate function …
Dec 28, 2020
e8c0016
Updated schema tests to use assertpy fluent assertions to validate in…
Dec 28, 2020
6204734
- Abstracted API methods into a people_client which makes use of a cu…
Dec 28, 2020
e5fe846
- Created BaseClient with default headers
Dec 28, 2020
8d2157d
Replaced specific method imports with *
Dec 29, 2020
77c7702
Updated README.md
Dec 29, 2020
69034c7
Added docker-compose for report portal
Jan 20, 2021
dec1b56
Added report portal agent into dependencies and added config for loca…
Jan 20, 2021
33308f2
Added logger in conftest.py and updated a test method to log to the c…
Jan 20, 2021
b390b1b
Updated docker-compose to generate report portal environment, Updated…
Feb 2, 2021
d4482fa
- Added pytest-xdist to Pipfile
Feb 23, 2021
924e0fa
Updated readme
Feb 23, 2021
c8dd36a
Bump lxml from 4.6.2 to 4.6.5
dependabot[bot] Dec 13, 2021
7977ac5
Merge pull request #7 from automationhacks/dependabot/pip/lxml-4.6.5
automationhacks Mar 12, 2022
046293f
Updated dependencies versions
Mar 12, 2022
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
Prev Previous commit
Next Next commit
Showing off user of requests.codes to have readable http codes
  • Loading branch information
Gaurav Singh committed Nov 25, 2020
commit 1a494c41334e6b844ce4034be9e0cb0353fe293a
8 changes: 3 additions & 5 deletions tests/people_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ def test_read_all_has_kent():
# We use requests.get() with url to make a get request
response = requests.get(BASE_URI)
# response from requests has many useful properties
# we can assert on the response status code
assert_that(response.status_code).is_equal_to(requests.codes.ok)
# We can get python dict as response by using .json() method
response_text = response.json()
pretty_print(response_text)

# Also we can assert on the response status code
assert_that(response.status_code).is_equal_to(200)
first_names = [people['fname'] for people in response_text]
assert_that(first_names).contains('Kent')

Expand All @@ -39,7 +37,7 @@ def test_new_person_can_be_added():

# We use requests.post method with keyword params to make the request more readable
response = requests.post(url=BASE_URI, data=payload, headers=headers)
assert_that(response.status_code).is_equal_to(204)
assert_that(response.status_code).is_equal_to(requests.codes.no_content)

# After user is created, we read all the users and then use filter expression to find if the
# created user is present in the response list
Expand Down