From 97490cafc1225e17d7668102b7d62246271724fc Mon Sep 17 00:00:00 2001 From: Josh Santos Date: Feb 13 2021 12:36:35 +0000 Subject: [PATCH 1/4] Exclude more paths for coverage --- diff --git a/.gitignore b/.gitignore index b8bb54d..80493cd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ *.egg-info build/ dist/ -.coverage +*coverage* alembic.ini .vagrant/ .tox/ From 461111c1fdeb49045428a191584d269352365386 Mon Sep 17 00:00:00 2001 From: Josh Santos Date: Feb 13 2021 12:41:51 +0000 Subject: [PATCH 2/4] Ignore client_secrets.json --- diff --git a/.gitignore b/.gitignore index 80493cd..f4d8b50 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,9 @@ *.egg-info build/ dist/ -*coverage* +.coverage +coverage.xml +client_secrets.json alembic.ini .vagrant/ .tox/ From 172d713c1438e06fa53161be94567f2105c378c1 Mon Sep 17 00:00:00 2001 From: Josh Santos Date: Feb 13 2021 12:43:04 +0000 Subject: [PATCH 3/4] Add missing requirement --- diff --git a/requirements.txt b/requirements.txt index 1f0e49d..b2b5e06 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,3 +12,4 @@ arrow blinker # required by Flask for the unit-tests (for signaling) six fasjson_client +fedora_elections_messages From 47cd757339cb396a6ca8994069fb91d4ccd0321d Mon Sep 17 00:00:00 2001 From: Josh Santos Date: Feb 13 2021 12:43:37 +0000 Subject: [PATCH 4/4] Improve documentation, adding tox section --- diff --git a/README.md b/README.md index 325ada6..35c96d4 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ development environment to test your changes. This is simplified by using [Vagrant](https://www.vagrantup.com/ "Vagrant by Hashicorp"), a powerful and useful tool for creating development environments on your workstation. + ### Using Vagrant You can quickly start hacking on the Fedora Elections web application using the @@ -46,6 +47,7 @@ vagrant ssh Once that is running, go to [localhost:5005](http://localhost:5005/) in your browser to see your running Fedora Elections test instance. + ### A note about fonts Fedora Elections uses web fonts hosted in Fedora's infrastructure that might @@ -104,30 +106,40 @@ You can obtain the code via: git clone https://pagure.io/elections.git ``` -### Configure the application +### Install pip requirements w/ tox for testing -An example configuration file is provided [here](https://pagure.io/elections/blob/master/f/files/fedora-elections.cfg "files/fedora-elections.cfg"). +Set up venv (replacing `` and ``): -### Create database +``` +pip install --user virtualenv tox +mkvirtualenv / +. / +``` -Run: +Install requirements: ``` -python createdb.py +pip install -r requirements.txt ``` +### Configure the application + +An example configuration file is provided [here](https://pagure.io/elections/blob/master/f/files/fedora-elections.cfg "files/fedora-elections.cfg"). + ### Register the application using openid-connect -Run: +From root of project, run: ``` -oidc-register https://iddev.fedorainfracloud.org/ http://localhost:5005/oidc_callback +oidc-register https://iddev.fedorainfracloud.org/ http://localhost:5005 ``` -Copy the corresponding ``client_secrets.json`` in the sources: +### Create database + +Run: ``` -cp client_secrets.json fedora_elections/client_secrets.json +python createdb.py ``` ### Create a local configuration file @@ -192,6 +204,18 @@ sudo systemctl restart httpd ``` +### Running tests +fedora-elections uses `tox` to simplify testing, and support testing across multiple environments. + +Refer to earlier in this section on "How to launch Fedora Elections" in this document to get set up with `tox` + +To run tests, simply run: + +``` +tox +``` + + ## How to contribute As mentioned earlier, this project is primarily hosted on [Pagure](https://pagure.io/elections "Fedora Infrastructure Elections application").