Skip to content

Commit

Permalink
Merge pull request #4536 from zenmonkeykstop/4526-metadata-functest
Browse files Browse the repository at this point in the history
add functional test for /metadata endpoint
  • Loading branch information
redshiftzero authored Jun 19, 2019
2 parents 38036ad + 794d3bd commit d57b040
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions securedrop/tests/functional/source_navigation_steps.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import tempfile
import time
import json

from selenium.webdriver.common.action_chains import ActionChains

Expand All @@ -22,6 +23,13 @@ def _source_visits_source_homepage(self):
self.driver.get(self.source_location)
assert self._is_on_source_homepage()

def _source_checks_instance_metadata(self):
self.driver.get(self.source_location + "/metadata")
j = json.loads(self.driver.find_element_by_tag_name("body").text)
assert j["server_os"] == "16.04"
assert j["sd_version"] == self.source_app.jinja_env.globals['version']
assert j["gpg_fpr"] != ""

def _source_clicks_submit_documents_on_homepage(self):
# First move the cursor to a known position in case it happens to
# be hovering over one of the buttons we are testing below.
Expand Down
10 changes: 10 additions & 0 deletions securedrop/tests/functional/test_source_metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from . import source_navigation_steps
from . import functional_test


class TestInstanceMetadata(
functional_test.FunctionalTest,
source_navigation_steps.SourceNavigationStepsMixin):

def test_instance_metadata(self):
self._source_checks_instance_metadata()

0 comments on commit d57b040

Please sign in to comment.