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
Add 'vars' key to endpoint node #328
Conversation
|
@gillianomenezes your pull request is missing a changelog! |
|
Hey @scanapi/core-team , Why this PR wasn't merged? |
|
@hebertjulio because I did not have time to test it locally, to check if everything is working fine |
|
Of course @camilamaia , I can go ahead, we are here for help. |
1514075
to
7d9e42d
Compare
Codecov Report
@@ Coverage Diff @@
## master #328 +/- ##
==========================================
+ Coverage 95.87% 95.95% +0.08%
==========================================
Files 22 22
Lines 678 693 +15
==========================================
+ Hits 650 665 +15
Misses 28 28
Continue to review full report at Codecov.
|
|
Hey, I created a PR at examples repository to endpoint vars test. |
@hebertjulio Awesome!! It is the best way to go! Only one detail: we need to first merge this PR, and then the examples one, right? Because we have github action checks that use the examples repo, and it would break if these changes are not there yet. https://github.com/scanapi/scanapi/blob/master/.github/workflows/run-examples.yml We could try to: . If everything works we:
Does that make sense? What do you think? |
|
Yes @camilamaia , that make full sense for me. Locally I tested both PR, but is always good idea that other dev test them too. |
|
@hebertjulio I am testing it locally here and it seems we have some problems. If we try to access In this line https://github.com/scanapi/examples/pull/27/files#diff-0db9b47343ca8e1c3f4eb61cfabd9a0cdd11862492fb6c72f63a0d512c1e0476R4, try to change it for vars:
greeting: ${USER}It is not replacing the value: With python code, it works fine: vars:
greeting: ${{ "hello" + "!" }}Probably it is not working for custom vars either... Also, i've started asking myself if the values are really being replaced in the # demo-api/snippets.yaml
name: snippets
path: snippets/
vars:
greeting: ${{ "hello" + "!" }}
headers:
Authorization: Token ${token}
requests:
- name: create
method: post
body:
title: Hello World
code: "print('${greeting} world')"
style: "xcode"
language: "python"
vars:
snippet_id: ${{response.json()["id"]}}
my_var_1: aloha! # THIS IS NEW
my_var_2: ${USER} # THIS IS NEW
tests:
- ...
- name: details
path: ${snippet_id}
vars:
my_var_3: ${my_var_1} # THIS IS NEW
tests:
- ...
- name: update_with_patch
path: ${snippet_id}/?${my_var_2}&${my_var_3} # THIS IS NEW
method: patch
body:
code: "print('${greeting}, patch')"
tests:
- ...
...
And the result is that we already have a problem... custom vars are not being replaced: Maybe we could have all these scenarion in our demo-api example.... And also, of course, in the unit tests |
c07a1be
to
1be299e
Compare
|
Hey @scanapi/core-team , I found two possible problem in request_node.py.
scanapi/scanapi/tree/request_node.py Lines 129 to 147 in d6df011
|
|
@hebertjulio great job! This is the core of the lib and you are getting familiar with it! It is amazing we have contributors who can discuss the core functions and how to solve this kind of problems For About the What do you think? |
Hey @camilamaia , thanks for the encouragement! About |
|
@hebertjulio hmm I am not sure I got the problem |
Yes, I wanna. |
|
@hebertjulio awesome, let's do it via Discord! |
Weekdays I get home at 20:30. |
1be299e
to
21960c9
Compare
cf20e4e
to
6449a62
Compare
@hebertjulio, great effort so far! This PR is very tricky. Thanks for tackling it. I left some suggestions, let me know what you think.
Also, let me know if you need any help with the unit tests.
c605f41
to
72fc17c
Compare
|
Hey @camilamaia Are Docstrings required in test functions? DeepSource is warning me about this. |
No they aren't. Let me add a filter for it, 1 sec |
|
@hebertjulio solved |
9b0a016
to
ae6f1f6
Compare
The solution is
ae6f1f6
to
c97cf61
Compare



Closes #302