GithubHelp home page GithubHelp logo

comitee's Introduction

Committee

An universal tool for checking commits on GitHub

Instrukce k testování balíčku

  1. tox

Spustí testy popsané v tox.ini s použitím nahraných kazet v test_my/fixtures/cassette_library. Funguje offline.

Znovu-nahrání kazet

Znovu-nahrání kazet vyžaduje určitý setup repozitářů. Pro jeho vytvoření použijte skript test_my/test_environment/setup.sh. Je třeba nastavit proměnné prostředí GH_TOKEN a GH_USER. Token musí příslušet danému uživateli a mít scope repo.

Skript využívá program hub, který si nejprve zprovozněte.

Skript vytvoří na GitHubu 3 repozitáře:

  • committee-basic
  • committee-rules
  • committee-radioactive

Pokud by vám to vadilo, použijte testovací účet k tomuto určený. Commit status nelze na GitHub smazat, tudíž jedinou možností, jak vyčistit případný nepořádek je repozitáře smazat pomocí skriptu test_my/test_environment/delete.sh (potřeba scope delete_repo).

Dále smažte všechny kazety v test_my/fixtures/cassette_library.

Spuštěním

python -m pytest -v test_my/

se smazané kazety znovu nahrají a zároveň se spustí testy.

comitee's People

Contributors

taios avatar

Watchers

 avatar

comitee's Issues

NI-PYT: odevzdání úlohy na testování

Všechny testy co jsem k aplikaci napsal jsou zde: comitee/test_my/.
Ze zadání jsem všechno implementoval a otestoval. Tag v0.4.0.

Tox spustí pouze /test_my/. Pro přídání referenčních testů stačí doplnit cestu sem:

comitee/tox.ini

Lines 4 to 7 in 598a634

[pytest]
addopts = -v
testpaths =
test_my


Největší problém jsem měl s testováním secretu. Ten se musí už nějak aplikaci předat při jejím vytváření. Chtěl jsem toto parametrizovat pomocí fixtures, ale nejlepší s čím jsem přišel je fixture wrapper:

@pytest.fixture
def testapp_with_config(cfg, session):
"""
Return FUNCTION that returns testing app, but with additional config set.
It is useful when parametrizing application secret.
"""
from committee.committee import create_app
os.environ["COMMITTEE_CONFIG"] = "test_my/fixtures/config/config_basic.cfg"
app = create_app(cfg, session)
app.config["TESTING"] = True
def testapp_with_config_wrapper(**kwargs):
for key, val in kwargs.items():
app.config[key] = val
return app.test_client()
return testapp_with_config_wrapper

Použití pak takto:

@pytest.mark.parametrize(["data", "secret", "github_event"], [("abc", "42", "invalid")])
def test_valid_signature_ping(testapp_with_config, secret, data, github_event):
"""Test if the app correctly responses to ping with valid signature"""
payload = {
"headers": {
"X-Hub-Signature": "sha1=" + hmac.new(secret.encode(), data.encode(), hashlib.sha1).hexdigest(),
"X-Github-Event": "ping"
},
"data": data
}
testapp = testapp_with_config(secret=secret)
r = testapp.post("/", **payload)

NI-PYT: submission of task one

Submitted task passes all tests (also radioactive). The output is not colorful because pytest with MINGW64 terminal on Windows interprets ANSI escape sequences as plain characters. However, all color functionality can be turned on by replacing five click.echo for print in src/printing.py or by switching to feature/colors branch.

NI-PYT: task 2 help with pythonanwhere

Got stuck at this error from pythonanywhere (most likely):

unable to load configuration from committee.cfg

Error is produced here to stderr after GitHub sends payload with push event.

Application otherwise works as expected: http://talos.pythonanywhere.com/
Running application at localhost and mocking GitHub payloads works without this error and sets correct status.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.