class RestComponentTestCase(unittest.TestCase):

  def setUp(self):
    super(RestComponentTestCase, self).setUp()
    self.rest = RestComponent()

  def test_init(self):
    self.assertEqual("", self.rest.url)
    self.assertEqual({}, self.rest.configuration)

  def test_configure(self):
    config = {RestComponent.URL: "a"}
    self.rest.configure(config)
    self.assertEqual(config, self.rest.configuration)
    self.assertEqual("a", self.rest.url)

  def test_configure_non_dict_error(self):
    with self.assertRaises(ConfigError):
      self.rest.configure(123)

  def test_configure_no_url(self):
    with self.assertRaises(ConfigError):
      self.rest.configure({})
 def setUp(self):
   super(RestComponentTestCase, self).setUp()
   self.rest = RestComponent()