Ejemplo n.º 1
0
 def test_lone_asterisk_matches_everything(self):
     pattern = '*'
     assert_true(Origin.match(pattern, 'https://ishkabibble.com:443'))
Ejemplo n.º 2
0
 def check_origin_permission(self, origin, dataset):
     for ds_origin in dataset.origins.all().prefetch_related('permissions'):
         if Origin.match(ds_origin.pattern, origin):
             return ds_origin, ds_origin
     raise PermissionDenied("None of the dataset's origin permission policies matched")
Ejemplo n.º 3
0
 def test_match_ports_with_asterisk(self):
     pattern = 'localhost:*'
     assert_false(Origin.match(pattern, 'https://github.com'))
     assert_true(Origin.match(pattern, 'http://localhost:8000'))
Ejemplo n.º 4
0
 def test_match_domains_with_scheme(self):
     pattern = 'http://github.com'
     assert_false(Origin.match(pattern, 'https://github.com'))
     assert_true(Origin.match(pattern, 'http://github.com'))
Ejemplo n.º 5
0
 def test_match_simple_domains(self):
     pattern = 'github.com'
     assert_true(Origin.match(pattern, 'https://github.com'))
     assert_false(Origin.match(pattern, 'ftp://github.com'))
     assert_false(Origin.match(pattern, 'http://openplans.github.com'))
Ejemplo n.º 6
0
 def test_match_subdomains_with_asterisk(self):
     pattern = '*.github.com'
     assert_false(Origin.match(pattern, 'https://github.com'))
     assert_true(Origin.match(pattern, 'http://openplans.github.com'))
     assert_false(Origin.match(pattern, 'http://openplansngithub.com'))
Ejemplo n.º 7
0
 def test_lone_asterisk_matches_everything(self):
     pattern = '*'
     assert_true(Origin.match(pattern, 'https://ishkabibble.com:443'))
Ejemplo n.º 8
0
 def test_match_domains_with_scheme(self):
     pattern = 'http://github.com'
     assert_false(Origin.match(pattern, 'https://github.com'))
     assert_true(Origin.match(pattern, 'http://github.com'))
Ejemplo n.º 9
0
 def test_match_ports_with_asterisk(self):
     pattern = 'localhost:*'
     assert_false(Origin.match(pattern, 'https://github.com'))
     assert_true(Origin.match(pattern, 'http://localhost:8000'))
Ejemplo n.º 10
0
 def test_match_subdomains_with_asterisk(self):
     pattern = '*.github.com'
     assert_false(Origin.match(pattern, 'https://github.com'))
     assert_true(Origin.match(pattern, 'http://openplans.github.com'))
     assert_false(Origin.match(pattern, 'http://openplansngithub.com'))
Ejemplo n.º 11
0
 def test_match_simple_domains(self):
     pattern = 'github.com'
     assert_true(Origin.match(pattern, 'https://github.com'))
     assert_false(Origin.match(pattern, 'ftp://github.com'))
     assert_false(Origin.match(pattern, 'http://openplans.github.com'))