class TestExternalDataSource(TestCase):

  def setUp(self):
    self.o = ExternalDataSource()

  def test_init(self):
    self.assertTrue(self.o)

  def test_provision_user(self):
    obj = self.o
    obj.external_source = 'foo'
    obj.provision_user(oid='oid', external_id='foo')
    self.assertEqual(models.User.objects.filter(username='******').count(), 1)
    self.assertEqual(models.Source.objects.filter(name='local').count(), 1)
    self.assertEqual(models.Attribute.objects.count(), 1)
    self.assertEqual(models.UserAttribute.objects.count(), 1)

  def test_oid(self):
    with self.assertRaises(NotImplementedError):
      self.o.get_oid(username='******')

  def test_data(self):
    with self.assertRaises(NotImplementedError):
      self.o.get_data(external_id='foo')

  def test_user_data(self):
    with self.assertRaises(NotImplementedError):
      self.o.get_user_data(request='foo')
 def setUp(self):
   self.o = ExternalDataSource()