Пример #1
0
 def test_not_match(self):
   """Tests not matching."""
   self.assertIsNone(
       tests.convert_dependency_url_to_local_path(
           'http://www.google.com/test.'))
   self.assertIsNone(tests.convert_dependency_url_to_local_path('random'))
   self.assertEqual(0, self.mock.normalize_path.call_count)
Пример #2
0
 def test_file_match_windows(self):
   """Tests matching a file URL."""
   self.mock.platform.return_value = 'WINDOWS'
   self.assertEqual(
       'C:/test/test.html',
       tests.convert_dependency_url_to_local_path('file:///C:/test/test.html'))
   self.mock.normalize_path.assert_called_once_with('C:/test/test.html')
Пример #3
0
 def test_file_match_linux(self):
   """Tests matching a file URL."""
   self.mock.platform.return_value = 'LINUX'
   self.assertEqual(
       '/mnt/scratch0/test.html',
       tests.convert_dependency_url_to_local_path(
           'file:///mnt/scratch0/test.html'))
   self.mock.normalize_path.assert_called_once_with('/mnt/scratch0/test.html')
Пример #4
0
 def test_file_match_android(self):
   """Tests matching a file URL."""
   self.mock.platform.return_value = 'ANDROID'
   self.assertEqual(
       '/mnt/scratch0/test.html',
       tests.convert_dependency_url_to_local_path(
           'file:///sdcard/fuzzer-testcases/test.html'))
   self.mock.normalize_path.assert_called_once_with('/mnt/scratch0/test.html')
Пример #5
0
 def test_url_match_127_0_0_1_with_port(self):
   """Tests matching a URL (127.0.0.1)."""
   self.mock.get_absolute_testcase_file.return_value = '/path'
   self.assertEqual(
       '/path',
       tests.convert_dependency_url_to_local_path(
           'http://127.0.0.1:8000/test/test.html'))
   self.mock.get_absolute_testcase_file.assert_called_once_with(
       '/test/test.html')
   self.mock.normalize_path.assert_called_once_with('/path')
Пример #6
0
 def test_url_match_any_ip_and_port(self):
   """Tests matching a URL (any ip and port)."""
   self.mock.get_absolute_testcase_file.return_value = '/path'
   self.assertEqual(
       '/path',
       tests.convert_dependency_url_to_local_path(
           'http://10.240.1.237:8002/test/test.html'))
   self.mock.get_absolute_testcase_file.assert_called_once_with(
       '/test/test.html')
   self.mock.normalize_path.assert_called_once_with('/path')