Ejemplo n.º 1
0
 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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
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'
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
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'
Ejemplo n.º 8
0
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)
Ejemplo n.º 9
0
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)
Ejemplo n.º 10
0
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')
Ejemplo n.º 11
0
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'
Ejemplo n.º 13
0
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"
Ejemplo n.º 14
0
 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)
Ejemplo n.º 15
0
 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)
Ejemplo n.º 17
0
 def test_index_loads(self):
     response = self.client.get(flask.url_for('index'))
     assert_no_response_errors(response)
Ejemplo n.º 18
0
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')
Ejemplo n.º 19
0
def test_raises_for_response_error():
    with pytest.raises(AssertionError):
        assert_no_response_errors(
            auto_namedtuple(response=auto_namedtuple(status_code=201)),
        )
Ejemplo n.º 20
0
 def test_easy_xdm_js(self):
     response = self.client.get('/easyXDM.debug.js')
     assert_no_response_errors(response)
Ejemplo n.º 21
0
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')
Ejemplo n.º 22
0
 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_easy_xdm_js(self):
     response = self.client.get('/easyXDM.debug.js')
     assert_no_response_errors(response)
Ejemplo n.º 24
0
def test_raises_for_response_error():
    with pytest.raises(AssertionError):
        assert_no_response_errors(
            auto_namedtuple(response=auto_namedtuple(status_code=201)), )
Ejemplo n.º 25
0
def test_ok_for_200():
    assert_no_response_errors(
        auto_namedtuple(response=auto_namedtuple(status_code=200)), )
Ejemplo n.º 26
0
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
Ejemplo n.º 27
0
 def test_cors_index(self):
     response = self.client.get('/cors/index.html')
     assert_no_response_errors(response)
Ejemplo n.º 28
0
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
Ejemplo n.º 29
0
def test_ok_for_200():
    assert_no_response_errors(
        auto_namedtuple(response=auto_namedtuple(status_code=200)),
    )
Ejemplo n.º 30
0
 def test_assertion_without_response_errors(self):
     response = auto_namedtuple(
         response=auto_namedtuple(status_code=200),
     )
     assert_no_response_errors(response)
 def test_cors_index(self):
     response = self.client.get('/cors/index.html')
     assert_no_response_errors(response)