Skip to content
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

Issue/1479 #1485

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open

Issue/1479 #1485

wants to merge 64 commits into from

Conversation

sanredz
Copy link

@sanredz sanredz commented Mar 8, 2023

This adds work towards Issue #1479

We added functionality, and accompanying tests, for four commands:

  • http template
    It is used to create a new command template. It takes three parameters at a minimum and then after that it also accepts key/value pairs, not single params like --something

  • http editt
    It is used to edit a template. It takes three parameter no equality signs. It does not take multiple.

  • http runt
    Runs a command. It takes one parameter .

  • http delt
    Deletes a template. It takes one parameter

The changes are:

  • In a new file at httpie/cli/argtemplates.py
  • In httpie/core.py
  • In a json file httpie/cli/templates.json

We are a group of KTH students and this was for a school project. Our time ran out so we didn't have time to fully develop it.
Things that would be good to add:

  • Adding functionality for running a template with parameters.
  • Adding better input validation.
  • Adding a --help section.
  • Adding single params to the template.
  • Editing multiple params in a template at the same time.

Sanjin and others added 30 commits March 1, 2023 15:23
This moves the load_template function to the argtemplate file as well as
makes the file path where the templates are stored into a
global variable.
Some tests fail when run on Mac but not on Windows. There appears to be
minor differences in the error output.
This adds a unit test that checks that a value is correctly updated
when modifying a certain parameter, and leaving the other values
unchanged.
This includes one test for overwriting an already existing template,
which passes, and one test for storing a template with an invalid method
parameter, which currently fails (see #11).
This adds two unit tests for loading a template which currently fail.
See #10 and #12 for details.
This removes a debugging print statement and adds some assertions.
Most of them currently fail since the functionality hasn't been
implemented/merged yet.
Fixes #6
bug(template): Fix invalid argument error #11
bug(test): Fix formatting for tests #18
Sanjin and others added 30 commits March 7, 2023 18:06
This makes sure that there is an error message printed when trying to
use a template that doesn't exist and makes sure that no unhandled
exceptions occur.
Fix error when trying to load nonexistent template
This removes tests that went against the specification and updates
`test_edit_template_not_found` to not look for an exception anymore,
since no exception is being raised.

Fixes #28
This adds tests that increases test coverage for argtemplate.py to 98%.

Fixes #30
Parameters after the URL that do not have the form key=value will
now be ignored. When loading a template, the parameters will be
reconstructed the same way they were passed in, i.e. as param=value.

Fixes #12
Add tests to increase coverage
Update keys when loading/storing templates
docs(templates): Add documentation to functions in argtemplates #15
The cases for too few args are not covered by tests since http() automatically adds
some flags which makes it impossible to test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants