Changeset f5b24d5 in trunk


Ignore:
Timestamp:
2022-11-29T15:18:57Z (3 years ago)
Author:
Jean-Paul Calderone <exarkun@…>
Branches:
master
Children:
920467d
Parents:
ac99442
git-author:
Jean-Paul Calderone <exarkun@…> (2022-11-29 15:14:08)
git-committer:
Jean-Paul Calderone <exarkun@…> (2022-11-29 15:18:57)
Message:

Add a test for missing Authorization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/allmydata/test/test_storage_http.py

    rac99442 rf5b24d5  
    3838from werkzeug import routing
    3939from werkzeug.exceptions import NotFound as WNotFound
     40from testtools.matchers import Equals
    4041
    4142from .common import SyncTestCase
     
    556557        self.http = self.useFixture(HttpTestFixture())
    557558
     559    def test_missing_authentication(self) -> None:
     560        """
     561        If nothing is given in the ``Authorization`` header at all an
     562        ``Unauthorized`` response is returned.
     563        """
     564        client = StubTreq(self.http.http_server.get_resource())
     565        response = self.http.result_of_with_flush(
     566            client.request(
     567                "GET",
     568                "http://127.0.0.1/storage/v1/version",
     569            ),
     570        )
     571        self.assertThat(response.code, Equals(http.UNAUTHORIZED))
     572
    558573    def test_bad_authentication(self):
    559574        """
Note: See TracChangeset for help on using the changeset viewer.