import unittest

import pytest

from legistar import base


class TestAPISearch(unittest.TestCase):

    def setUp(self):
        self.scraper = base.LegistarAPIScraper(None, None)
        self.scraper.BASE_URL = 'http://webapi.legistar.com/v1/chicago'
        self.scraper.retry_attempts = 0
        self.scraper.requests_per_minute = 0
        
    def test_search_raises(self):
        with pytest.raises(ValueError):
            results = self.scraper.search('/events/', 'EventId',
                                          "MatterFile eq 'O2010-5046'")
            list(results)
            
    def test_search(self):
        results = self.scraper.search('/matters/', 'MatterId',
                                      "MatterFile eq 'O2010-5046'")
        
        
        assert len(list(results)) == 1

@@ -1,21 +1,4 @@
-import unittest%0A%0A
 impo
@@ -39,84 +39,59 @@
 se%0A%0A
-%0Aclass TestAPISearch(unittest.TestCase):%0A%0A    def setUp(self):%0A        self.
+@pytest.fixture(scope=%22module%22)%0Adef scraper():%0A    
 scra
@@ -132,33 +132,24 @@
 , None)%0A    
-    self.
 scraper.BASE
@@ -195,33 +195,24 @@
 hicago'%0A    
-    self.
 scraper.retr
@@ -234,17 +234,8 @@
     
-    self.
 scra
@@ -262,28 +262,70 @@
 ute = 0%0A    
-    
+return scraper%0A%0A%0Aclass TestAPISearch(object):%0A
 %0A    def tes
@@ -340,24 +340,33 @@
 _raises(self
+, scraper
 ):%0A        w
@@ -410,37 +410,32 @@
       results = 
-self.
 scraper.search('
@@ -485,37 +485,32 @@
                 
- 
-    
 %22MatterFile eq '
@@ -586,16 +586,25 @@
 rch(self
+, scraper
 ):%0A     
@@ -620,13 +620,8 @@
 s = 
-self.
 scra
@@ -652,29 +652,24 @@
 'MatterId',%0A
-     
             

use pytest conventions