Skip to content

Commit

Permalink
[OpenDataServices/cove#104] Test loading to virtuoso staging/live
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjwebb committed Oct 5, 2015
1 parent 1e084e9 commit 5975453
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion fts/test_dataload.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

server_url = os.environ['SERVER_URL']
prefix = '/'
dataset_url = None

@pytest.fixture(scope="module")
def browser(request):
Expand All @@ -16,18 +17,38 @@ def browser(request):
return browser


def test_googledoc_input(browser):
@pytest.fixture(scope="module")
def google_doc_dataset(request, browser):
source_url = 'https://docs.google.com/spreadsheets/d/1lZBVe6TGfrPYtaP4bqP9OZ0WG26vh_jTzOOm1h2Qdc4/edit#gid=0'

browser.get(server_url + prefix)
browser.find_element_by_id('id_source_url').send_keys(source_url)
browser.find_element_by_css_selector("#fetchURL > div.form-group > button.btn.btn-primary").click()
dataset_url = browser.current_url

browser.find_element_by_css_selector("button.btn.btn-default.convert").click()

return dataset_url


def test_googledoc_input(browser, google_doc_dataset):
browser.get(google_doc_dataset)
ttl_href = browser.find_element_by_link_text('Outputted TTL').get_attribute('href')
assert 'Block 15' in requests.get(ttl_href).text


@pytest.mark.parametrize('process_id,other_process_id', [ ('staging', 'live'), ('live', 'staging') ])
def test_push(browser, google_doc_dataset, process_id, other_process_id):
browser.find_element_by_css_selector("button.btn.btn-default.{}".format(process_id)).click()
# Check if it's in
url = 'http://localhost:8890/sparql?default-graph-uri=&query=select+%3Fs+WHERE+%7B+%3Fs+a+%3Chttp%3A%2F%2Fresourceprojects.org%2Fdef%2FProject%3E+%7D&format=application%2Fsparql-results%2Bjson&timeout=0&debug=on'
assert 'resourceprojects.org' in requests.get(url, headers={'Host': process_id}).text
if other_process_id != 'staging':
assert 'resourceprojects.org' not in requests.get(url, headers={'Host': other_process_id}).text
browser.find_element_by_css_selector("button.btn.btn-default.rm_{}".format(process_id)).click()
assert 'resourceprojects.org' not in requests.get(url, headers={'Host': process_id}).text


def test_humanize_naturaltime(browser):
'''
This test loads a file from a url into the resourceprojects interface.
Expand Down

1 comment on commit 5975453

@Bjwebb
Copy link
Contributor Author

@Bjwebb Bjwebb commented on 5975453 Oct 5, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also tests that deletion works - OpenDataServices/cove#112

Please sign in to comment.