from disco.test import DiscoJobTestFixture, DiscoTestCase

from cStringIO import StringIO

class AuthJobTestCase(DiscoJobTestFixture, DiscoTestCase):
    input = []

    @staticmethod
    def map(e, params):
        return [(e.strip(), '')]

    @property
    def answers(self):
        return [('blobdata', '')]

    def setUp(self):
        tag = 'disco:test:authjob'
        pushed = self.ddfs.push(tag, [(StringIO('blobdata'), 'blob')])
        self.ddfs.setattr(tag, 'ddfs:read-token', 'r')
        self.input = ['tag://u:r@/' + tag]
        super(AuthJobTestCase, self).setUp()

    def tearDown(self):
        super(AuthJobTestCase, self).tearDown()
        self.ddfs.delete('disco:test:authjob')

@@ -20,74 +20,25 @@
 ort 
-DiscoJobTestFixture, DiscoTestCase%0A%0Afrom cStringIO import StringIO
+TestCase, TestJob
 %0A%0Acl
@@ -52,69 +52,18 @@
 hJob
+(
 Test
-Case(DiscoJobTestFixture, DiscoTestCase):%0A    input = %5B%5D%0A
+Job):
 %0A   
@@ -109,25 +109,22 @@
         
-return %5B(
+yield 
 e.strip(
@@ -132,25 +132,39 @@
 , ''
-)%5D%0A%0A    @property
+%0A%0Aclass AuthTestCase(TestCase):
 %0A   
@@ -172,15 +172,13 @@
 def 
-answers
+setUp
 (sel
@@ -193,55 +193,80 @@
     
-return %5B('blobdata', '')%5D%0A%0A    def setUp(self):
+super(AuthTestCase, self).setUp()%0A        from cStringIO import StringIO
 %0A   
@@ -270,16 +270,21 @@
         
+self.
 tag = 'd
@@ -313,17 +313,8 @@
     
- pushed =
  sel
@@ -325,16 +325,21 @@
 fs.push(
+self.
 tag, %5B(S
@@ -368,16 +368,40 @@
 blob')%5D)
+%0A%0A    def runTest(self):
 %0A       
@@ -419,16 +419,21 @@
 setattr(
+self.
 tag, 'dd
@@ -470,16 +470,34 @@
 elf.
+job = AuthJob().run(
 input
- = 
+=
 %5B'ta
@@ -505,20 +505,31 @@
 ://u
+ser
 :r@/
-' + 
+%25s' %25 self.
 tag%5D
+)
 %0A   
@@ -538,42 +538,54 @@
    s
-uper(AuthJobTestCase, self).setUp(
+elf.assertResults(self.job, %5B('blobdata', '')%5D
 )%0A%0A 
@@ -625,19 +625,16 @@
 per(Auth
-Job
 TestCase
@@ -677,30 +677,18 @@
 .delete(
-'disco:test:authjob'
+self.tag
 )%0A

convert test_authjob