Beispiel #1
0
    def test_http_exception_404(self):
        service = DALService('http://example.com/query/nonexistant')

        try:
            service.search()
        except DALServiceError as exc:
            assert exc.code == 404
        else:
            assert False
Beispiel #2
0
    def test_http_exception_500(self):
        service = DALService('http://example.com/query/errornous')

        try:
            service.search()
        except DALServiceError as exc:
            assert exc.code == 500
        else:
            assert False
Beispiel #3
0
    def test_http_exception_500(self):
        service = DALService('http://example.com/query/errornous')

        try:
            service.search()
        except DALServiceError as exc:
            assert exc.code == 500
        else:
            assert False
Beispiel #4
0
    def test_http_exception_404(self):
        service = DALService('http://example.com/query/nonexistant')

        try:
            service.search()
        except DALServiceError as exc:
            assert exc.code == 404
        else:
            assert False
Beispiel #5
0
    def test_search(self):
        """
        Test (in conjunction with mocker) that parameters arrive serverside,
        while also ensuring data consistency
        """
        service = DALService('http://example.com/query/verbosetest')
        dalresults = service.search(VERBOSE=1)

        _test_results(dalresults)
        _test_records(dalresults)
Beispiel #6
0
    def test_search(self):
        """
        Test (in conjunction with mocker) that parameters arrive serverside,
        while also ensuring data consistency
        """
        service = DALService('http://example.com/query/verbosetest')
        dalresults = service.search(VERBOSE=1)

        _test_results(dalresults)
        _test_records(dalresults)
Beispiel #7
0
    def test_format_exception(self):
        with pytest.raises(DALFormatError):
            service = DALService('http://example.com/query/missingtable')
            service.search()

        with pytest.raises(DALFormatError):
            service = DALService('http://example.com/query/missingresource')
            service.search()

        with pytest.raises(DALFormatError):
            service = DALService('http://example.com/query/missingcolumns')
            service.search()
Beispiel #8
0
    def test_query_exception(self):
        service = DALService('http://example.com/query/errorstatus')

        with pytest.raises(DALQueryError):
            service.search()
Beispiel #9
0
 def test_useragent(self):
     service = DALService('http://example.com/query/useragent')
     service.search()
Beispiel #10
0
    def test_format_exception(self):
        with pytest.raises(DALFormatError):
            service = DALService('http://example.com/query/missingtable')
            service.search()

        with pytest.raises(DALFormatError):
            service = DALService('http://example.com/query/missingresource')
            service.search()

        with pytest.raises(DALFormatError):
            service = DALService('http://example.com/query/missingcolumns')
            service.search()
Beispiel #11
0
    def test_query_exception(self):
        service = DALService('http://example.com/query/errorstatus')

        with pytest.raises(DALQueryError):
            service.search()
Beispiel #12
0
 def test_useragent(self):
     service = DALService('http://example.com/query/useragent')
     service.search()
Beispiel #13
0
 def test_init(self):
     """Test if baseurl if passed correctly"""
     service = DALService('http://example.com/query/basic')
     assert service.baseurl == 'http://example.com/query/basic'