Пример #1
0
 def test_get_urls_from_flat_url(self):
     from smoketest.directives import get_urls_from_element
     options = Mock()
     options.scheme = None
     options.port = '8999'
     options.level = 'stag'
     options.cachebust = False
     elem = {
         'url': 'http://www.usnews.com',
     }
     results = get_urls_from_element(elem, options)
     self.assertEqual(results[0], 'http://www-stag.usnews.com:8999')
     self.assertEqual(len(results), 1)
Пример #2
0
 def test_urls_from_dict_of_urls_use_other(self):
     from smoketest.directives import get_urls_from_element
     options = Mock()
     options.scheme = None
     options.port = '8999'
     options.level = 'sand14'
     options.cachebust = False
     elem = {
         'url': {
             'stag': 'http://www.usnews.com',
             'other': 'http://www.google.com',
         }
     }
     results = get_urls_from_element(elem, options)
     self.assertEqual(results[0], 'http://www-sand14.google.com:8999')
     self.assertEqual(len(results), 1)
Пример #3
0
    def test_urls_from_dict_of_urls_use_non_other(self):
        from smoketest.directives import get_urls_from_element
        options = Mock()
        options.port = '8999'
        options.level = 'stag'
        options.cachebust = True
        elem = {
            'url': {
                'stag': 'usnews.com',
                'other': 'google.com',
            }
        }
        results = get_urls_from_element(elem, options)

        # Notice that it should not be cachebusted.
        self.assertEqual(results[0], 'usnews.com')
        self.assertEqual(len(results), 1)
Пример #4
0
 def test_get_urls_from_element_with_url_list(self):
     from smoketest.directives import get_urls_from_element
     options = Mock()
     options.scheme = None
     options.port = ''
     options.level = 'live'
     options.cachebust = False
     elem = {
         "urls": [
             "http://www.usnews.com",
             "http://www.indeed.com",
         ],
         "status": "404",
     }
     expected = [
         "http://www.usnews.com",
         "http://www.indeed.com",
     ]
     actual = get_urls_from_element(elem, options)
     self.assertEqual(expected, actual)