def test_gsc_none_string(self):
     """Tests the response to a GSC request with a list of wrong typed
     fields.
     """
     fields = [1, 2, 3]
     with self.assertRaises(RemotingException):
         metadata_protocol.write_get_schema(fields)
예제 #2
0
 def test_gsc_none_string(self):
     """Tests the response to a GSC request with a list of wrong typed
     fields.
     """
     fields = [1, 2, 3]
     with self.assertRaises(RemotingException):
         metadata_protocol.write_get_schema(fields)
 def execute():
     try:
         fields = self._adapter.get_schema(user, session_id, group,
                                           schema)
         if not fields:
             METADATA_LOGGER.warning(("None or empty field list from "
                                      "get_schema for schema '%s' in "
                                      "group '%s'"), schema, group)
     except Exception as err:
         res = meta_protocol.write_get_schema(exception=err)
     else:
         res = meta_protocol.write_get_schema(fields)
     return res
 def execute():
     try:
         fields = self._adapter.get_schema(user, session_id, group,
                                           schema)
         if not fields:
             METADATA_LOGGER.warning(("None or empty field list from "
                                      "get_schema for schema '%s' in "
                                      "group '%s'"), schema, group)
     except Exception as err:
         res = meta_protocol.write_get_schema(exception=err)
     else:
         res = meta_protocol.write_get_schema(fields)
     return res
예제 #5
0
 def test_gsc_tobe_quoted_from_bytes(self):
     """Tests the response to a GSC request with a single item whose name
     is expressed as a byte string.
     """
     fields = [b'a long field name']
     res = metadata_protocol.write_get_schema(fields)
     self.assertEqual("GSC|S|a+long+field+name", res)
예제 #6
0
 def test_gsc_tobe_quoted_symbol(self):
     """Tests the response to a GSC request with a single item whose name
     contains the symbol '@'.
     """
     fields = ["A symbol to encode ž"]
     res = metadata_protocol.write_get_schema(fields)
     self.assertEqual("GSC|S|A+symbol+to+encode+%C5%BE", res)
예제 #7
0
 def test_gsc_tobe_quoted_spaces(self):
     """Tests the response to a GSC request with a single fields whose name
     is space separated.
     """
     items = ["a long field name"]
     res = metadata_protocol.write_get_schema(items)
     self.assertEqual("GSC|S|a+long+field+name", res)
 def test_gsc_tobe_quoted_from_bytes(self):
     """Tests the response to a GSC request with a single item whose name
     is expressed as a byte string.
     """
     fields = [b'a long field name']
     res = metadata_protocol.write_get_schema(fields)
     self.assertEqual("GSC|S|a+long+field+name", res)
 def test_gsc_tobe_quoted_symbol(self):
     """Tests the response to a GSC request with a single item whose name
     contains the symbol '@'.
     """
     fields = ["A symbol to encode ž"]
     res = metadata_protocol.write_get_schema(fields)
     self.assertEqual("GSC|S|A+symbol+to+encode+%C5%BE", res)
 def test_gsc_tobe_quoted_spaces(self):
     """Tests the response to a GSC request with a single fields whose name
     is space separated.
     """
     items = ["a long field name"]
     res = metadata_protocol.write_get_schema(items)
     self.assertEqual("GSC|S|a+long+field+name", res)
 def test_gsc_schema_error(self):
     """Tests the response to a GSC request in case of an ItemsError."""
     error = SchemaError("Schema Error")
     res = metadata_protocol.write_get_schema(exception=error)
     self.assertEqual("GSC|ES|Schema+Error", res)
예제 #12
0
 def test_gsc_more(self):
     """Tests the response to a GSC request with more than only one field.
     """
     fields = ["field1", "field2"]
     res = metadata_protocol.write_get_schema(fields)
     self.assertEqual("GSC|S|field1|S|field2", res)
예제 #13
0
 def test_gsc_one(self):
     """Tests the response to a GSC request with a single field."""
     fields = ["field1"]
     res = metadata_protocol.write_get_schema(fields)
     self.assertEqual("GSC|S|field1", res)
예제 #14
0
 def test_gsc_none(self):
     """Tests the response to a GSC request with a None list of fields."""
     fields = None
     res = metadata_protocol.write_get_schema(fields)
     self.assertEqual("GSC", res)
예제 #15
0
 def test_gsc_schema_error(self):
     """Tests the response to a GSC request in case of an ItemsError."""
     error = SchemaError("Schema Error")
     res = metadata_protocol.write_get_schema(exception=error)
     self.assertEqual("GSC|ES|Schema+Error", res)
 def test_gsc_none(self):
     """Tests the response to a GSC request with a None list of fields."""
     fields = None
     res = metadata_protocol.write_get_schema(fields)
     self.assertEqual("GSC", res)
 def test_gsc_more(self):
     """Tests the response to a GSC request with more than only one field.
     """
     fields = ["field1", "field2"]
     res = metadata_protocol.write_get_schema(fields)
     self.assertEqual("GSC|S|field1|S|field2", res)
 def test_gsc_one(self):
     """Tests the response to a GSC request with a single field."""
     fields = ["field1"]
     res = metadata_protocol.write_get_schema(fields)
     self.assertEqual("GSC|S|field1", res)
예제 #19
0
 def test_gsc_generic_exception(self):
     """Tests the response to a GSC request in case of a generic exception.
     """
     error = RuntimeError("Generic Error")
     res = metadata_protocol.write_get_schema(exception=error)
     self.assertEqual("GSC|E|Generic+Error", res)
 def test_gsc_generic_exception(self):
     """Tests the response to a GSC request in case of a generic exception.
     """
     error = RuntimeError("Generic Error")
     res = metadata_protocol.write_get_schema(exception=error)
     self.assertEqual("GSC|E|Generic+Error", res)