diff --git a/.gitignore b/.gitignore index 31e6bcf64793e49a455deb9a98122f93eb3394e0..6eddb66f8da3af4b77f0af2c82e08aed03316bc9 100755 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ VIPSWeb/local_settings.py .project .pydevproject *.pyc +geckodriver.log VIPSWeb/static/admin VIPSWeb/static/test/2012-02-10.kml VIPSWeb/static/test/2012-02-10.kml~ diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000000000000000000000000000000000..58c087b07377e369ba0f53d81cd05fe829630be9 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,36 @@ +node { + + try { + stage('Checkout') { + checkout scm + } + stage('Test'){ + sh """ + virtualenv --python=python2.7 env + . env/bin/activate + pip install -r requirements.txt + pip install selenium + cp VIPSWeb/local_settings_sample.py VIPSWeb/local_settings.py + ./manage.py collectstatic + ./manage.py runserver & + ./manage.py test + + """ + } + stage ('Build') { + + } + + } + + catch (err) { + + throw err + } + + finally { + sh """ + rm -rf static + """ + } +} diff --git a/VIPSWeb/local_settings_sample.py b/VIPSWeb/local_settings_sample.py index e87634e2e1f4944d2f77f1e99da15004921dd4dc..f3a9f02d63313278c05f4e7bd5b95a66c6ced80e 100755 --- a/VIPSWeb/local_settings_sample.py +++ b/VIPSWeb/local_settings_sample.py @@ -32,7 +32,7 @@ MAINTENANCE_MODE = False # Hosts/domain names that are valid for this site; required if DEBUG is False # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts -ALLOWED_HOSTS = ["www.example.com"] +ALLOWED_HOSTS = ["localhost"] SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) @@ -41,7 +41,7 @@ SITE_ROOT = os.path.dirname(os.path.realpath(__file__)) # in apps' "static/" subdirectories and in STATICFILES_DIRS. # Example: "/var/www/example.com/static/" # Use 'python manage.py collectstatic' to put stuff into here -STATIC_ROOT = '/somewhere/VIPSWeb/static' +STATIC_ROOT = SITE_ROOT + '/../static/' # Make this unique, and don't share it with anybody. SECRET_KEY = '#### HIDDEN ###' @@ -113,7 +113,7 @@ GOOGLE_ANALYTICS_SCRIPT = """ # The server name used for VIPSLogic VIPSLOGIC_SERVER_NAME = "vipslogic" # VIPSLogic protocol -VIPSLOGIC_PROTOCOL = "https" +VIPSLOGIC_PROTOCOL = "http" # This organization's ID in VIPSLogic/CoreManager VIPS_ORGANIZATION_ID = 1 # Use this if you want to override and show icons for stations belonging to several organizations diff --git a/VIPSWeb/static/js/frontpage.js b/VIPSWeb/static/js/frontpage.js index 9b2546149909804cd840e5d8d212bfb2770cde3c..4824d32ada511b06f1eef1327563b30afcb39c19 100755 --- a/VIPSWeb/static/js/frontpage.js +++ b/VIPSWeb/static/js/frontpage.js @@ -533,9 +533,8 @@ var cachedPois; function cacheForecastSummaries() { //$.getJSON(settings.vipslogicProtocol + "://" + settings.vipslogicServerName + "/rest/forecastconfigurationsummaries/" + settings.vipsOrganizationId, function( json ) { - $.getJSON( "/vipslogicproxy/rest/forecastconfigurationsummaries/" + settings.vipsOrganizationId - + (settings.includeOrganizationIds != null ? "?includeOrganizationIds=" + settings.includeOrganizationIds.join(",") : "") - , function( json ) { + $.getJSON( "/vipslogicproxy/rest/forecastconfigurationsummaries/" + settings.vipsOrganizationId + "?foo=bar" + (settings.userUuid != null ? "&userUuid=" + settings.userUuid : "") + + (settings.includeOrganizationIds != null ? "&includeOrganizationIds=" + settings.includeOrganizationIds.join(",") : ""), function( json ) { cachedForecastSummaries = json; cachePrivateForecastSummaries(); diff --git a/VIPSWeb/test.py b/VIPSWeb/test.py new file mode 100644 index 0000000000000000000000000000000000000000..cc1c5a96702b086f4dad4aa69b913772186f3c5a --- /dev/null +++ b/VIPSWeb/test.py @@ -0,0 +1,23 @@ +from django.test import TestCase +import unittest +from selenium import webdriver +from selenium.webdriver.firefox.options import Options + +options = Options() +options.headless = True + +#Test suit +class SearchText(unittest.TestCase): + def setUp(self): + self.driver = webdriver.Firefox(options=options) + self.driver.implicitly_wait(10) + self.driver.get("http://localhost:8000") + + def test_maintenance_mode(self): + assert "Site down for maintenance" in self.driver.page_source + + def tearDown(self): + self.driver.quit() + +if __name__ == '__main__': + unittest.main() diff --git a/forecasts/models.py b/forecasts/models.py index 10d896ce40af705cd8571f43570e95c553affbfc..fb83dbe6d5d46cc2580de2e85f9f44320548b5ab 100755 --- a/forecasts/models.py +++ b/forecasts/models.py @@ -231,7 +231,7 @@ class ForecastConfiguration: crop_organism_id_paramstring += "&cropOrganismId=%s" % crop_organism_id request_result = None - if settings.INCLUDE_ORGANIZATION_IDS == None: + if settings.INCLUDE_ORGANIZATION_IDS == None or len(settings.INCLUDE_ORGANIZATION_IDS) == 1: """print "%s://%s/rest/organizationforecastconfigurations/%s?from=%s-01-01&to=%s-12-31%s" % ( settings.VIPSLOGIC_PROTOCOL, settings.VIPSLOGIC_SERVER_NAME, diff --git a/forecasts/views.py b/forecasts/views.py index 400eff6c7e8b0d68fa164bedf149c14a3e62fbee..d1edf5083527ffa38aae36a770e788667adaf9cc 100755 --- a/forecasts/views.py +++ b/forecasts/views.py @@ -32,6 +32,7 @@ def index(request): season_range = range(2016, datetime.now().year + 1) season = int(request.GET.get("season", (datetime.now() + relativedelta(months = settings.SYSTEM_TIME_OFFSET_MONTHS)).year)) forecast_configurations = ForecastConfiguration.get_forecast_configurations_from_vipslogic(None, season).text + #print forecast_configurations private_forecast_configurations = None if request.session.get("user_uuid",None) != None: private_forecast_configurations = ForecastConfiguration.get_private_forecast_configurations(request.session["user_uuid"]) diff --git a/fusarium/templates/fusarium/oat_flowering.html b/fusarium/templates/fusarium/oat_flowering.html index 9e9bf95409c33e88e9c7a45d0d4e016d275cb724..39b537a3f40762b139a63847df815bfe34b39593 100755 --- a/fusarium/templates/fusarium/oat_flowering.html +++ b/fusarium/templates/fusarium/oat_flowering.html @@ -10,7 +10,7 @@ <p> Her kan du beregne tidspunkt for når havren er i blomst og dermed når en eventuell behandling med soppmiddel mot Fusarium må utføres. - <a href='http://gamlevips.nibio.no/information/if105s.jsp?HTTP_REFERRER=/information/if105s.jsp&BUTTON=kapittel&menyValg=4#blomstringsmodell_havre' target='new'>Les mer</a> + <a href='/forecasts/models/OATFLOWERM/' target='new'>Les mer</a> </p> <div id="oatFloweringModelForm" style="width:100%"></div> <div id="oatFloweringModelResults" style="width:100%;"></div> diff --git a/mock/templates/mock/zymogridmapclient.html b/mock/templates/mock/zymogridmapclient.html index 9d89a3296cd9ebc17530301d3870f30559f8a4d0..9daaf2c43bbf2a77e1fce3850e3393a9dc3350dc 100644 --- a/mock/templates/mock/zymogridmapclient.html +++ b/mock/templates/mock/zymogridmapclient.html @@ -15,14 +15,17 @@ <h1>Let's say this is the EuroWheat web page</h1> <p>What you do is that you include the following code in your HTML</p> <code> - <div id="zymoGridMapContainer" style="width:800px;" data-language="dk"></div><br/> - <script id="zymoGridMapScript" type="text/javascript" src="{{settings.VIPSLOGIC_PROTOCOL}}://{{settings.VIPSLOGIC_SERVER_NAME}}/public/nordic_septoria_whs/nordic_septoria_whs.js"/></script> + <div id="nordicSeptoriaMapContainer" style="width:800px;" data-language="dk" data-mainmap-height="700px;"></div><br/> + <script id="nordicSeptoriaMapScript" type="text/javascript" src="{{settings.VIPSLOGIC_PROTOCOL}}://{{settings.VIPSLOGIC_SERVER_NAME}}/public/nordic_septoria_map/nordic_septoria_map.js"/></script> </code> <p>Then the application will look like this</p> - <div id="zymoGridMapContainer" style="width:800px;" data-language="dk"></div> - <script id="zymoGridMapScript" type="text/javascript" src="{{settings.VIPSLOGIC_PROTOCOL}}://{{settings.VIPSLOGIC_SERVER_NAME}}/public/nordic_septoria_whs/nordic_septoria_whs.js"/></script> + <div id="nordicSeptoriaMapContainer" style="width:800px;" data-language="dk" data-mainmap-height="700px;"></div> + <script id="nordicSeptoriaMapScript" type="text/javascript" src="{{settings.VIPSLOGIC_PROTOCOL}}://{{settings.VIPSLOGIC_SERVER_NAME}}/public/nordic_septoria_map/nordic_septoria_map.js"/></script> <!--script id="zymoGridMapScript" type="text/javascript" src="http://restclienthtml/public/nordic_septoria_whs/nordic_septoria_whs.js"/></script--> - <p>If you omit the style attribute, the application will fill all available space</p> - <p>If you omit the data-language attribute, the default language (en) will be used. Currently supported languages are no, dk and en. </p> + <ul> + <li>If you omit the style attribute, the application will fill all available space</li> + <li>If you omit the data-language attribute, the default language (en) will be used. Currently supported languages are no, dk and en. </li> + <li>If you omit the data-mainmap-height attribute, the main map's height will be 450px.</li> + </ul> </body> </html> \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 51f11c6da1b8daae6f360022959a1d7b15d3c7b4..b937bd70cb49aa881324a92c309a9b16fe4f9e52 100755 --- a/requirements.txt +++ b/requirements.txt @@ -23,3 +23,4 @@ Pillow requests==2.6.0 django-tinymce==2.8.0 python-dateutil==1.5 +selenium