예제 #1
0
    def test_equality(self):
        gobject_x = geo.Gobject(self.data)

        jdata = json.loads(self.data)
        gobject_y = geo.Gobject(jdata)

        assert gobject_x == gobject_y
예제 #2
0
    def test_inverse(self):
        '''Bijective function test.

        It checks wether data can be mapped back or not. If test is green
        then the whole object works as needed, bijection exists, data is safe.
        '''
        gobject = geo.Gobject(self.data)
        json_data = json.loads(self.data)
        assert gobject.serialize() == json_data
예제 #3
0
 def test_unknown_error_exception(self):
     with pytest.raises(exception.UnknownError):
         geo.Gobject({'status': 'UNKNOWN_ERROR'})
예제 #4
0
 def test_invalid_request_exception(self):
     with pytest.raises(exception.InvalidRequestError):
         geo.Gobject({'status': 'INVALID_REQUEST'})
예제 #5
0
 def test_request_denied_exception(self):
     with pytest.raises(exception.RequestDeniedError):
         geo.Gobject({'status': 'REQUEST_DENIED'})
예제 #6
0
 def test_over_query_limit_exception(self):
     with pytest.raises(exception.OverQueryLimitError):
         geo.Gobject({'status': 'OVER_QUERY_LIMIT'})
예제 #7
0
 def test_zero_results_exception(self):
     with pytest.raises(exception.ZeroResultsError):
         geo.Gobject({'status': 'ZERO_RESULTS'})
예제 #8
0
 def test_wrong_initialization(self):
     with pytest.raises(exception.UnsupportedDataTypeError):
         gobject = geo.Gobject(123)