...

Text file src/github.com/google/go-github/v47/test/README.md

Documentation: github.com/google/go-github/v47/test

     1go-github tests
     2===============
     3
     4This directory contains additional test suites beyond the unit tests already in
     5[../github](../github). Whereas the unit tests run very quickly (since they
     6don't make any network calls) and are run by Travis on every commit, the tests
     7in this directory are only run manually.
     8
     9The test packages are:
    10
    11integration
    12-----------
    13
    14This will exercise the entire go-github library (or at least as much as is
    15practical) against the live GitHub API. These tests will verify that the
    16library is properly coded against the actual behavior of the API, and will
    17(hopefully) fail upon any incompatible change in the API.
    18
    19Because these tests are running using live data, there is a much higher
    20probability of false positives in test failures due to network issues, test
    21data having been changed, etc.
    22
    23These tests send real network traffic to the GitHub API and will exhaust the
    24default unregistered rate limit (60 requests per hour) very quickly.
    25Additionally, in order to test the methods that modify data, a real OAuth token
    26will need to be present. While the tests will try to be well-behaved in terms
    27of what data they modify, it is **strongly** recommended that these tests only
    28be run using a dedicated test account.
    29
    30Run tests using:
    31
    32    GITHUB_AUTH_TOKEN=XXX go test -v -tags=integration ./integration
    33
    34Some tests create repositories. By default, the new repositories will be owned
    35by the user identified by the OAuth token. Set the `GITHUB_OWNER='<GH_OWNER>'`
    36environment variable to specify a different owner, such as an organization.
    37
    38Additionally there are a set of integration tests for the Authorizations API.
    39These tests require a GitHub user (username and password), and also that a
    40[GitHub Application](https://github.com/settings/applications/new) (with
    41attendant Client ID and Client Secret) be available. Then, to execute just the
    42Authorization tests:
    43
    44    GITHUB_USERNAME='<GH_USERNAME>' GITHUB_PASSWORD='<GH_PASSWORD>' GITHUB_CLIENT_ID='<CLIENT_ID>' GITHUB_CLIENT_SECRET='<CLIENT_SECRET>' go test -v -tags=integration -run=Authorizations ./integration
    45
    46If some or all of these environment variables are not available, certain of the
    47Authorization integration tests will be skipped.
    48
    49fields
    50------
    51
    52This will identify the fields being returned by the live GitHub API that are
    53not currently being mapped into the relevant Go data type. Sometimes fields
    54are deliberately not mapped, so the results of this tool should just be taken
    55as a hint.
    56
    57This test sends real network traffic to the GitHub API and will exhaust the
    58default unregistered rate limit (60 requests per hour) very quickly.
    59Additionally, some data is only returned for authenticated API calls. Unlike
    60the integration tests above, these tests only read data, so it's less
    61imperative that these be run using a dedicated test account (though you still
    62really should).
    63
    64Run the fields tool using:
    65
    66    GITHUB_AUTH_TOKEN=XXX go run ./fields/fields.go

View as plain text