Beispiel #1
0
def create_pumps(obj):
    """

    """
    term = SearchTerm.objects.get(pk=1)
    obj.query = ReservoirQuery(searchterms=[term])
    reservoir = Reservoir.objects.get(name='twitter')
    obj.stream_pump = Pump(reservoir=reservoir, task=BKGD_SRCH)
    obj.nonstream_pump = Pump(reservoir=reservoir, task=ADHOC_SRCH)
Beispiel #2
0
    def setUp(self):
        term = SearchTerm.objects.get(pk=1)
        self.query = ReservoirQuery(searchterms=[term])
        self.subquery1 = Mock()
        self.subquery2 = Mock()
        self.query_list = [self.subquery1, self.subquery2]

        reservoir = Reservoir.objects.get(name='twitter')
        self.stream_pump = Pump(reservoir=reservoir, task='BKGD_SRCH')
        self.nonstream_pump = Pump(reservoir=reservoir, task='ADHOC_SRCH')

        self.task1 = 'BKGD_SRCH'
        self.task2 = 'ADHOC_SRCH'
        self.task3 = 'FAKE_TASK'
Beispiel #3
0
 def test_with_missing_specsheet(self):
     """
     Tests the _pipe property for a Pipe doesn't exist.
     """
     reservoir = Reservoir.objects.get(name='facebook')
     pump = Pump(reservoir=reservoir, task=ADHOC_SRCH)
     msg = 'The Pipe "Facebook GraphAPI" has no Specsheet'
     with six.assertRaisesRegex(self, SpecsheetDoesNotExist, msg):
         pump._specsheet
Beispiel #4
0
 def test_with_missing_pipe(self):
     """
     Tests the _pipe property for a Pipe doesn't exist.
     """
     reservoir = Reservoir.objects.get(name='twitter')
     pump = Pump(reservoir=reservoir, task=FAKE_TASK)
     msg = 'The Reservoir "twitter" has no Pipe for the Task "FAKE_TASK"'
     with six.assertRaisesRegex(self, PipeDoesNotExist, msg):
         pump._pipe
Beispiel #5
0
 def _create_pump(self, reservoir):
     """
     Takes a Reservoir and creates a Pump to pull data from that Reservoir,
     appropriate to the PumpRoom's user and task.
     """
     return Pump(
         reservoir=reservoir,
         task=self.task,
         user=self.user,
     )