diff --git a/.travis.yml b/.travis.yml index b72f88a6e0..05d805e2ed 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,21 +1,37 @@ dist: xenial - services: - - postgresql +- postgresql addons: - postgresql: "9.4" + postgresql: '9.4' +branches: + only: + - master before_script: - - psql -U postgres -c "create user decide password 'decide'" - - psql -U postgres -c "create database test_decide owner decide" - - psql -U postgres -c "ALTER USER decide CREATEDB" +- psql -U postgres -c "create user decide password 'decide'" +- psql -U postgres -c "create database test_decide owner decide" +- psql -U postgres -c "ALTER USER decide CREATEDB" language: python python: - - "3.6" +- '3.6' install: - - pip install -r requirements.txt - - pip install codacy-coverage +- pip install -r requirements.txt +- pip install codacy-coverage script: - - cd decide - - coverage run --branch --source=. ./manage.py test --keepdb --with-xunit - - coverage xml - - python-codacy-coverage -r coverage.xml +- cd decide +- cp travis_local_settings.py local_settings.py +- coverage run --branch --source=. ./manage.py test authentication visualizer voting + --keepdb +- coverage xml +- python-codacy-coverage -r coverage.xml +notifications: + email: + recipients: + - moimarram@alum.us.es + on_success: always + on_failure: always +deploy: + provider: heroku + app: egc-guadalquivir-vis + strategy: git + api_key: + secure: lwACeWnAlexzrSMQpw0PRxh+n+JS3vyB1RT5kF7nuEdYfmBCyNqACiqFkSu741RHFei3xmSs4pDgx8qxdnj7ortk94Nh3b1PNquAy5h/Y7c/2GjhJVQtFWcDmAEFYCNOkt6J6OPCmjyS7akLON1XWt9jBE9Dmpwbg9idVwXfcPkFEqQsEZ6Bd1q27d2A6pAd6i+8zCXxixf2ORs6+J3Z5PG7TWNgM6ZlAYiDjRLVfHNcy3/uVzjfM0tdLp6na9cjN4NFd+8Ag/40w02okDHlapdWdTXk3gncqNg2Bcc9O4T4upe1wps++34V7OWy7wYldbN+OhIdlXccY078m7FNQMwG5at/Qw/UV2J7yhJ18TfBL2hh6AEMkEAm6sSn/EwbwKGSiFLBQ96hrkX8N6fARA45bUI8MrE3bCiIDxKRVcSvPBlW9Z1DWcaYnOFWUcZEac4tnVJgp4MikSEwGlD1A59xx9ADwM9w3Ww9plDm8vUgiQN6OGjys+olV1JN+Dd1dCj36vGuL/h7413v2barfbvetS5zH7ZE2O0cxML99hGwt96jo+IhwPoBODGmPAIdMFhNzmHczqGiwGk9vU20N8K+INNRRcyP2B/OPUBgVa43HHQR8xm0ljAL0Lst14rWRXm0uCSwAGg24JTjNVVW6k5s9dUd6jYTxm0s2mBhQuw= diff --git a/Procfile b/Procfile new file mode 100644 index 0000000000..818fef7fe3 --- /dev/null +++ b/Procfile @@ -0,0 +1,4 @@ +% prepara el repositorio para su despliegue. +release: sh -c 'cd decide && python manage.py migrate' +% especifica el comando para lanzar Decide +web: sh -c 'cd decide && gunicorn decide.wsgi --log-file -' diff --git a/decide/decide/settings b/decide/decide/settings new file mode 100644 index 0000000000..e69de29bb2 diff --git a/decide/decide/settings.py b/decide/decide/settings.py index 1d22b67324..f15cf5ab06 100644 --- a/decide/decide/settings.py +++ b/decide/decide/settings.py @@ -161,10 +161,14 @@ # number of bits for the key, all auths should use the same number of bits KEYBITS = 256 +APIS = {} + # Versioning ALLOWED_VERSIONS = ['v1', 'v2'] DEFAULT_VERSION = 'v1' +BASEURL = "https://egc-guadalquivir-vis.herokuapp.com" + try: from local_settings import * except ImportError: @@ -180,3 +184,6 @@ INSTALLED_APPS = INSTALLED_APPS + MODULES + +import django_heroku +django_heroku.settings(locals()) diff --git a/decide/geckodriver b/decide/geckodriver new file mode 100755 index 0000000000..bf9538e6a6 Binary files /dev/null and b/decide/geckodriver differ diff --git a/decide/geckodriver-v0.27.0-linux64.tar.gz b/decide/geckodriver-v0.27.0-linux64.tar.gz new file mode 100644 index 0000000000..7ef741eb8e Binary files /dev/null and b/decide/geckodriver-v0.27.0-linux64.tar.gz differ diff --git a/decide/geckodriver-v0.27.0-linux64.tar.gz.1 b/decide/geckodriver-v0.27.0-linux64.tar.gz.1 new file mode 100644 index 0000000000..7ef741eb8e Binary files /dev/null and b/decide/geckodriver-v0.27.0-linux64.tar.gz.1 differ diff --git a/decide/testFace.py b/decide/testFace.py new file mode 100644 index 0000000000..9431815ea6 --- /dev/null +++ b/decide/testFace.py @@ -0,0 +1,26 @@ +# Generated by Selenium IDE +import pytest +import time +import json +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.common.action_chains import ActionChains +from selenium.webdriver.support import expected_conditions +from selenium.webdriver.support.wait import WebDriverWait +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.common.desired_capabilities import DesiredCapabilities + +class TestFacebook(): + def setup_method(self, method): + self.driver = webdriver.Chrome() + self.vars = {} + + def teardown_method(self, method): + self.driver.quit() + + def test_facebook(self): + self.driver.get("https://egc-guadalquivir-vis.herokuapp.com/visualizer/2/") + self.driver.set_window_size(1298, 863) + self.driver.find_element(By.CSS_SELECTOR, "a:nth-child(1) > img").click() + assert self.driver.find_element(By.ID, "homelink").text == "Facebook" + diff --git a/decide/testFace2.py b/decide/testFace2.py new file mode 100644 index 0000000000..bc43dcbd44 --- /dev/null +++ b/decide/testFace2.py @@ -0,0 +1,26 @@ +# Generated by Selenium IDE +import pytest +import time +import json +from selenium import webdriver +from selenium.webdriver.common.by import By +from selenium.webdriver.common.action_chains import ActionChains +from selenium.webdriver.support import expected_conditions +from selenium.webdriver.support.wait import WebDriverWait +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.common.desired_capabilities import DesiredCapabilities + +class TestTestFAceboooooooooooooooook2(): + def setup_method(self, method): + self.driver = webdriver.Chrome() + self.vars = {} + + def teardown_method(self, method): + self.driver.quit() + + def test_testFAceboooooooooooooooook2(self): + self.driver.get("https://egc-guadalquivir-vis.herokuapp.com/visualizer/2/") + self.driver.set_window_size(1298, 863) + self.driver.find_element(By.CSS_SELECTOR, "a:nth-child(1) > img").click() + assert self.driver.find_element(By.CSS_SELECTOR, ".\\_51m-:nth-child(2)").text == "Compartir en Facebook" + diff --git a/decide/local_settings.example.py b/decide/travis_local_settings.py similarity index 54% rename from decide/local_settings.example.py rename to decide/travis_local_settings.py index 41db563a5a..d4162dae92 100644 --- a/decide/local_settings.example.py +++ b/decide/travis_local_settings.py @@ -14,25 +14,25 @@ ] APIS = { - 'authentication': 'http://10.5.0.1:8000', - 'base': 'http://10.5.0.1:8000', - 'booth': 'http://10.5.0.1:8000', - 'census': 'http://10.5.0.1:8000', - 'mixnet': 'http://10.5.0.1:8000', - 'postproc': 'http://10.5.0.1:8000', - 'store': 'http://10.5.0.1:8000', - 'visualizer': 'http://10.5.0.1:8000', - 'voting': 'http://10.5.0.1:8000', + 'authentication': 'http://localhost:8000', + 'base': 'http://localhost:8000', + 'booth': 'http://localhost:8000', + 'census': 'http://localhost:8000', + 'mixnet': 'http://localhost:8000', + 'postproc': 'http://localhost:8000', + 'store': 'http://localhost:8000', + 'visualizer': 'http://localhost:8000', + 'voting': 'http://localhost:8000', } -BASEURL = 'http://10.5.0.1:8000' +BASEURL = 'http://localhost:8000' DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', 'NAME': 'postgres', 'USER': 'postgres', - 'HOST': 'db', + 'HOST': 'localhost', 'PORT': '5432', } } diff --git a/decide/visualizer/templates/visualizer/visualizer.html b/decide/visualizer/templates/visualizer/visualizer.html index 0faed6bac3..bd452b4cb0 100644 --- a/decide/visualizer/templates/visualizer/visualizer.html +++ b/decide/visualizer/templates/visualizer/visualizer.html @@ -6,23 +6,145 @@ href="https://unpkg.com/bootstrap/dist/css/bootstrap.min.css" /> - + + + + {% endblock %} {% block content %} + + +