示例#1
0
  def test_derive_pattern_match__multi_level_pattern(self):
    self.assertEqual((ShortLink.get_by_id(116), 'http://looker.com/1/search/sales'),
                     helpers.derive_pattern_match('1.com', 'looker/1/sales'))

    # no looker/%s shortlink exists:
    self.assertEqual((None, None),
                     helpers.derive_pattern_match('1.com', 'looker/sales'))
示例#2
0
    def test_derive_pattern_match__go_link_exists_for_one_company_but_not_other(
            self):
        self.assertEqual((None, None),
                         helpers.derive_pattern_match('1.com', 'paper/kpis'))

        self.assertEqual((ShortLink.get_by_id(114), 'http://paper.com/kpis'),
                         helpers.derive_pattern_match('2.com', 'paper/kpis'))
示例#3
0
  def test_derive_pattern_match__same_shortlink_different_companies(self):
    self.assertEqual((ShortLink.get_by_id(15), 'http://drive5.com/roadmap'),
                     helpers.derive_pattern_match('2.com', 'drive/roadmap'))

    self.assertEqual((ShortLink.get_by_id(15), 'http://drive5.com/roadmap'),
                     helpers.derive_pattern_match('2.com', 'drive/roadmap'))

    self.assertEqual((ShortLink.get_by_id(16), 'http://drive6.com/roadmap'),
                     helpers.derive_pattern_match('1.com', 'drive/roadmap'))

    self.assertEqual((ShortLink.get_by_id(16), 'http://drive6.com/roadmap'),
                     helpers.derive_pattern_match('1.com', 'drive/roadmap'))

    self.assertEqual((None, None),
                     helpers.derive_pattern_match('3.com', 'drive/roadmap'))
示例#4
0
 def test_derive_pattern_match__one_level_shortlink(self):
     self.assertEqual((None, None),
                      helpers.derive_pattern_match('1.com', 'notes'))