def get_testdata(request, project, branch, revision): """ Apply data filters and return all test data objects associated with the revision. """ product_name = request.GET.get("product", None) os_name = request.GET.get("os_name", None) os_version = request.GET.get("os_version", None) branch_version = request.GET.get("branch_version", None) processor = request.GET.get("processor", None) build_type = request.GET.get("build_type", None) test_name = request.GET.get("test_name", None) page_name = request.GET.get("page_name", None) return HttpResponse( json.dumps( testdata.get_testdata( project, branch, revision, product_name=product_name, os_name=os_name, os_version=os_version, branch_version=branch_version, processor=processor, build_type=build_type, test_name=test_name, page_name=page_name, )), content_type=API_CONTENT_TYPE, )
def test_get_testdata_no_filter(ptm, ptrdm, monkeypatch): """ Test getting json blobs for tests by branch and revision """ def mock_ptrdm(project): return ptrdm monkeypatch.setattr(factory, 'get_ptrdm', mock_ptrdm) def mock_ptm(project): return ptm monkeypatch.setattr(factory, 'get_ptm', mock_ptm) add_test_data(ptm) result = testdata.get_testdata( ptm.project, "Mozilla-Aurora", "785345035a3b", ) assert len(result) == 3 suites = [x["testrun"]["suite"] for x in result] assert set(suites) == set(["truth", "myth", "myth"])
def get_testdata(request, project, branch, revision): """ Apply data filters and return all test data objects associated with the revision. """ product_name = request.GET.get("product", None) os_name = request.GET.get("os_name", None) os_version = request.GET.get("os_version", None) branch_version = request.GET.get("branch_version", None) processor = request.GET.get("processor", None) build_type = request.GET.get("build_type", None) test_name = request.GET.get("test_name", None) page_name = request.GET.get("page_name", None) return HttpResponse( json.dumps(testdata.get_testdata( project, branch, revision, product_name=product_name, os_name=os_name, os_version=os_version, branch_version=branch_version, processor=processor, build_type=build_type, test_name=test_name, page_name=page_name, )), content_type=API_CONTENT_TYPE, )
def test_get_testdata_filter_test_name(ptm, ptrdm, monkeypatch): def mock_ptrdm(project): return ptrdm monkeypatch.setattr(factory, 'get_ptrdm', mock_ptrdm) def mock_ptm(project): return ptm monkeypatch.setattr(factory, 'get_ptm', mock_ptm) add_test_data(ptm) result = testdata.get_testdata( ptm.project, "Mozilla-Aurora", "785345035a3b", test_name="truth" ) assert len(result) == 1 assert result[0]["testrun"]["suite"] == "truth"
def test_get_testdata_filter_test_name(ptm, ptrdm, monkeypatch): def mock_ptrdm(project): return ptrdm monkeypatch.setattr(factory, 'get_ptrdm', mock_ptrdm) def mock_ptm(project): return ptm monkeypatch.setattr(factory, 'get_ptm', mock_ptm) add_test_data(ptm) result = testdata.get_testdata(ptm.project, "Mozilla-Aurora", "785345035a3b", test_name="truth") assert len(result) == 1 assert result[0]["testrun"]["suite"] == "truth"
def test_get_testdata_filter_os_name(ptm, ptrdm, monkeypatch): def mock_ptrdm(project): return ptrdm monkeypatch.setattr(factory, 'get_ptrdm', mock_ptrdm) def mock_ptm(project): return ptm monkeypatch.setattr(factory, 'get_ptm', mock_ptm) add_test_data(ptm) result = testdata.get_testdata( ptm.project, "Mozilla-Aurora", "785345035a3b", os_name="mac" ) assert len(result) == 2 suites = [x["testrun"]["suite"] for x in result] assert set(suites) == set(["truth", "myth"])
def test_get_testdata_filter_os_name(ptm, ptrdm, monkeypatch): def mock_ptrdm(project): return ptrdm monkeypatch.setattr(factory, 'get_ptrdm', mock_ptrdm) def mock_ptm(project): return ptm monkeypatch.setattr(factory, 'get_ptm', mock_ptm) add_test_data(ptm) result = testdata.get_testdata(ptm.project, "Mozilla-Aurora", "785345035a3b", os_name="mac") assert len(result) == 2 suites = [x["testrun"]["suite"] for x in result] assert set(suites) == set(["truth", "myth"])