def test_jar_home(self): resp = self.client.get(flask.url_for( 'jar.jar_home', jar_type=self.jar_type, user_jar_name=self.user_jar_name, )) assert_no_response_errors(resp)
def test_it_loads_for_first_commit(server_with_data): resp = server_with_data.server.client.get( flask.url_for( 'commit.show', sha=server_with_data.cloneable_with_commits.commits[0].sha, ), ) assert_no_response_errors(resp)
def test_show_succeeds_for_empty_range(server): resp = server.client.get(flask.url_for( 'graph.show', metric_name=PythonImportCount.__name__, start='0', end='0', )) assert_no_response_errors(resp)
def test_it_loads(server_with_data): resp = server_with_data.server.client.get(flask.url_for( 'commit.show', sha=server_with_data.cloneable_with_commits.commits[3].sha, )) assert_no_response_errors(resp) import_row = resp.pq.find('th:contains("PythonImportCount")').parent() assert import_row.find('td').text() == '2'
def test_it_loads(server_with_data): resp = server_with_data.server.client.get( flask.url_for( 'commit.show', sha=server_with_data.cloneable_with_commits.commits[3].sha, ), ) assert_no_response_errors(resp) import_row = resp.pq.find('th:contains("PythonImportCount")').parent() assert import_row.find('td').text() == '2'
def test_show(server_with_data): timestamp = server_with_data.cloneable_with_commits.commits[0].date resp = server_with_data.server.client.get(flask.url_for( 'graph.show', metric_name=PythonImportCount.__name__, start=five.text(timestamp - 1000), end=five.text(timestamp + 1000), )) assert_no_response_errors(resp)
def test_show(server_with_data): timestamp = server_with_data.cloneable_with_commits.commits[0].date resp = server_with_data.server.client.get(flask.url_for( 'graph.show', metric_name=PythonImportCount.__name__, start=six.text_type(timestamp - 1000), end=six.text_type(timestamp + 1000), )) assert_no_response_errors(resp)
def test_renders_description(server): resp = server.client.get(flask.url_for( 'graph.show', metric_name=BinaryFileCount.__name__, start='0', end='0', )) assert_no_response_errors(resp) desc = resp.pq.find('.description') expected = 'Counts the number of files considered to be binary by git.' assert desc.text() == expected # should have formatted the markdown assert desc.find('code')
def test_renders_description(server): resp = server.client.get( flask.url_for( 'graph.show', metric_name=BinaryFileCount.__name__, start='0', end='0', ), ) assert_no_response_errors(resp) desc = resp.pq.find('.description') expected = 'Counts the number of files considered to be binary by git.' assert desc.text() == expected # should have formatted the markdown assert desc.find('code')
def test_changes_endpoint(server_with_data): resp = server_with_data.server.client.get( flask.url_for( 'changes.show', metric_name='PythonImportCount', start_timestamp=0, # Some sufficiently large number to include all the data end_timestamp=2**62, )) assert_no_response_errors(resp) pq = pyquery.PyQuery(resp.json['body']) # Should have a table in output assert len(pq.find('table')) == 1 # Should show the metric went up by 2 assert pq.find('.metric-up').text() == '2'
def test_changes_endpoint(server_with_data): resp = server_with_data.server.client.get( flask.url_for( "changes.show", metric_name="PythonImportCount", start_timestamp=0, # Some sufficiently large number to include all the data end_timestamp=2 ** 62, ) ) assert_no_response_errors(resp) pq = pyquery.PyQuery(resp.json["body"]) # Should have a table in output assert len(pq.find("table")) == 1 # Should show the metric went up by 2 assert pq.find(".metric-up").text() == "2"
def test_index_internal_exposes_jar_list(self): with self.client.patch_ip('127.0.0.1'): response = self.client.get(flask.url_for('index')) assert_no_response_errors(response) T.assert_length(response.pq.find(self._get_jar_list_selector()), 1)
def test_index_external_does_not_expose_jar_list(self): response = self.client.get(flask.url_for('index')) assert_no_response_errors(response) T.assert_length(response.pq.find(self._get_jar_list_selector()), 0)
def test_index_loads(self): response = self.client.get(flask.url_for('index')) assert_no_response_errors(response)
def test_widget_frame_loads(server): response = server.client.get(flask.url_for('widget.frame')) assert_no_response_errors(response) assert response.pq.find('script')
def test_raises_for_response_error(): with pytest.raises(AssertionError): assert_no_response_errors( auto_namedtuple(response=auto_namedtuple(status_code=201)), )
def test_easy_xdm_js(self): response = self.client.get('/easyXDM.debug.js') assert_no_response_errors(response)
def test_assertion_with_response_errors(self): with T.assert_raises(AssertionError): response = auto_namedtuple( response=auto_namedtuple(status_code=500), ) assert_no_response_errors(response)
def test_ok_for_200(): assert_no_response_errors( auto_namedtuple(response=auto_namedtuple(status_code=200)), )
def _test_it_loads(server): response = server.client.get(flask.url_for('index.show')) assert_no_response_errors(response) # Should have a nonzero number of links to things assert response.pq.find('a[href]') return response
def test_cors_index(self): response = self.client.get('/cors/index.html') assert_no_response_errors(response)
def _test_it_loads(server): response = server.client.get(flask.url_for('index.show')) assert_no_response_errors(response) # Should have a nonzero number of links to things assert len(response.pq.find('a[href]')) > 0
def test_assertion_without_response_errors(self): response = auto_namedtuple( response=auto_namedtuple(status_code=200), ) assert_no_response_errors(response)