Пример #1
0
 def setUp(self):
     """Sets up the test harness."""
     testutil.setup_for_testing()
     self.callback = 'http://foo.callback-example.com/my-callback-url'
     self.topic = 'http://example.com/my-topic-url'
     self.token = 'token'
     self.secret = 'my secrat'
Пример #2
0
    def setUp(self):
        """Sets up the test harness."""
        testutil.setup_for_testing()
        self.mapper = offline_jobs.CountSubscribers()
        self.callback = 'http://foo.callback-example.com/my-callback-url'
        self.topic = 'http://example.com/my-topic-url'
        self.token = 'token'
        self.secret = 'my secrat'
        # Do not make these raw strings on purpose, since they will get
        # passed through escaped in the mapreduce.yaml.
        self.topic_pattern = '^http://example\\.com/.*$'
        self.callback_pattern = (
            'http(?:s)?://(?:[^\\.]+\\.)*([^\\./]+\.[^\\./]+)(?:/.*)?')

        class FakeMapper(object):
            params = {
                'topic_pattern': self.topic_pattern,
                'callback_pattern': self.callback_pattern,
            }

        class FakeSpec(object):
            mapreduce_id = '1234'
            mapper = FakeMapper()

        self.context = context.Context(FakeSpec(), None)
        context.Context._set(self.context)
Пример #3
0
 def setUp(self):
   """Sets up the test harness."""
   testutil.setup_for_testing()
   self.callback = 'http://foo.callback-example.com/my-callback-url'
   self.topic = 'http://example.com/my-topic-url'
   self.token = 'token'
   self.secret = 'my secrat'
Пример #4
0
 def setUp(self):
   """Sets up the test harness."""
   testutil.setup_for_testing(require_indexes=False)
   self.now1 = 1274078068.886692
   self.now2 = 1274078097.79072
   self.gettime1 = lambda: self.now1
   self.gettime2 = lambda: self.now2
   os.environ['CURRENT_VERSION_ID'] = 'myversion.1234'
   if 'HTTP_X_APPENGINE_TASKNAME' in os.environ:
     del os.environ['HTTP_X_APPENGINE_TASKNAME']
Пример #5
0
 def setUp(self):
     """Sets up the test harness."""
     testutil.setup_for_testing(require_indexes=False)
     self.now1 = 1274078068.886692
     self.now2 = 1274078097.79072
     self.gettime1 = lambda: self.now1
     self.gettime2 = lambda: self.now2
     os.environ['CURRENT_VERSION_ID'] = 'myversion.1234'
     if 'HTTP_X_APPENGINE_TASKNAME' in os.environ:
         del os.environ['HTTP_X_APPENGINE_TASKNAME']
Пример #6
0
 def setUp(self):
     """Sets up the test harness."""
     testutil.setup_for_testing()
     self.topic = 'http://example.com/my-topic/1'
     self.topic2 = 'http://example.com/my-topic/2'
     self.format = 'atom'
     self.header_footer = '<feed><id>tag:my-id</id>\n</feed>'
     self.entries_map = {
         'one': '<entry>first data</entry>',
         'two': '<entry>second data</entry>',
         'three': '<entry>third data</entry>',
     }
     os.environ['CURRENT_VERSION_ID'] = 'my-version.1234'
     virtual_feed.VIRTUAL_FEED_QUEUE.queue_name = 'default'
Пример #7
0
 def setUp(self):
   """Sets up the test harness."""
   testutil.setup_for_testing()
   self.topic = 'http://example.com/my-topic/1'
   self.topic2 = 'http://example.com/my-topic/2'
   self.format = 'atom'
   self.header_footer = '<feed><id>tag:my-id</id>\n</feed>'
   self.entries_map = {
     'one': '<entry>first data</entry>',
     'two': '<entry>second data</entry>',
     'three': '<entry>third data</entry>',
   }
   os.environ['CURRENT_VERSION_ID'] = 'my-version.1234'
   virtual_feed.VIRTUAL_FEED_QUEUE.queue_name = 'default'
Пример #8
0
  def setUp(self):
    """Sets up the test harness."""
    testutil.setup_for_testing()
    self.mapper = offline_jobs.SubscriptionReconfirmMapper()
    self.callback = 'http://example.com/my-callback-url'
    self.topic = 'http://example.com/my-topic-url'
    self.token = 'token'
    self.secret = 'my secrat'

    self.now = datetime.datetime.utcnow()
    self.threshold_seconds = 1000
    self.threshold_timestamp = (
        time.mktime(self.now.utctimetuple()) + self.threshold_seconds)
    self.getnow = lambda: self.now

    class FakeMapper(object):
      params = {'threshold_timestamp': str(self.threshold_timestamp)}
    class FakeSpec(object):
      mapreduce_id = '1234'
      mapper = FakeMapper()
    self.context = context.Context(FakeSpec(), None)
    context.Context._set(self.context)
Пример #9
0
  def setUp(self):
    """Sets up the test harness."""
    testutil.setup_for_testing()
    self.mapper = offline_jobs.CountSubscribers()
    self.callback = 'http://foo.callback-example.com/my-callback-url'
    self.topic = 'http://example.com/my-topic-url'
    self.token = 'token'
    self.secret = 'my secrat'
    # Do not make these raw strings on purpose, since they will get
    # passed through escaped in the mapreduce.yaml.
    self.topic_pattern = '^http://example\\.com/.*$'
    self.callback_pattern = (
        'http(?:s)?://(?:[^\\.]+\\.)*([^\\./]+\.[^\\./]+)(?:/.*)?')

    class FakeMapper(object):
      params = {
        'topic_pattern': self.topic_pattern,
        'callback_pattern': self.callback_pattern,
      }
    class FakeSpec(object):
      mapreduce_id = '1234'
      mapper = FakeMapper()
    self.context = context.Context(FakeSpec(), None)
    context.Context._set(self.context)
Пример #10
0
 def setUp(self):
   """Sets up the test harness."""
   testutil.setup_for_testing()
   self.app = 'my-app-id'
   self.entity_kind = 'main.Subscription'
   self.namespace = 'my-namespace'