Пример #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)