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

Fixed #23606 -- Implement the RequestFactory trace() method #3353

Closed
wants to merge 1 commit into from

Conversation

zedr
Copy link
Contributor

@zedr zedr commented Oct 13, 2014

The RequestFactory class did not implement a trace() method, and
therefore raised an AttributeError when used to create TRACE requests.

This change implements a factory method that returns a very basic TRACE
request object, which should be suitable for most test cases.

It also reworks the original TestClientTests suite so that the following
conditions are checked:

- The test factory can create requests for all the HTTP/1.1 methods;
- The GET request test is tested separately;
- The TRACE request is tested with a test view that simulates the
  echo response, according to rfc2616.

This fixes https://code.djangoproject.com/ticket/23606

self.request_factory = RequestFactory()

def tearDown(self):
del(self.request_factory)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be del self.request_factory.

@zedr
Copy link
Contributor Author

zedr commented Oct 13, 2014

Commit f863574 changes the tearDown() method to use del as a keyword, as recommended.

@@ -22,7 +22,7 @@ restricted subset of the test client API:
* It only has access to the HTTP methods :meth:`~Client.get()`,
:meth:`~Client.post()`, :meth:`~Client.put()`,
:meth:`~Client.delete()`, :meth:`~Client.head()` and
:meth:`~Client.options()`.
:meth:`~Client.options()`, :meth:`~Client.trace()`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to move the "and" from line 24.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops.. Fixed in 0c5a657

@timgraham
Copy link
Member

You can go ahead and squash your commits after those updates, thanks.

@zedr
Copy link
Contributor Author

zedr commented Oct 24, 2014

I've submitted the changes, as suggested. Thanks for the feedback.

"""
Send a TRACE request to the server.

:param path: the Request-URI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment about comment style applies here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@timgraham
Copy link
Member

Could you squash the commits please?

The RequestFactory class did not implement a trace() method, and
therefore raised an AttributeError when used to create TRACE requests.

This change implements a factory method that returns a very basic TRACE
request object, which should be suitable for most test cases.

It also reworks the original TestClientTests suite so that the following
conditions are checked:

    - The test factory can create requests for all the HTTP/1.1 methods;
    - The GET request test is tested separately;
    - The TRACE request is tested with a test view that simulates the
      echo response, according to rfc2616.
@zedr
Copy link
Contributor Author

zedr commented Oct 27, 2014

I have now squashed all the my commits.

@timgraham
Copy link
Member

buildbot, test this please.

@timgraham
Copy link
Member

merged in 2863439, thanks!

@timgraham timgraham closed this Oct 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants