Skip to content

Commit 9ee08d4

Browse files
committed
tests: Use example.org rather than potentially-valid domain name
1 parent 1b06b39 commit 9ee08d4

File tree

8 files changed

+69
-69
lines changed

8 files changed

+69
-69
lines changed

tests/test_authorization_code.py

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def setUp(self):
4444

4545
self.application = Application(
4646
name="Test Application",
47-
redirect_uris="http://localhost http://example.com http://example.it custom-scheme://example.com",
47+
redirect_uris="http://localhost http://example.com http://example.org custom-scheme://example.com",
4848
user=self.dev_user,
4949
client_type=Application.CLIENT_CONFIDENTIAL,
5050
authorization_grant_type=Application.GRANT_AUTHORIZATION_CODE,
@@ -73,7 +73,7 @@ def test_request_is_not_overwritten(self):
7373
'response_type': 'code',
7474
'state': 'random_state_string',
7575
'scope': 'read write',
76-
'redirect_uri': 'http://example.it',
76+
'redirect_uri': 'http://example.org',
7777
})
7878
url = "{url}?{qs}".format(url=reverse('oauth2_provider:authorize'), qs=query_string)
7979

@@ -96,7 +96,7 @@ def test_skip_authorization_completely(self):
9696
'response_type': 'code',
9797
'state': 'random_state_string',
9898
'scope': 'read write',
99-
'redirect_uri': 'http://example.it',
99+
'redirect_uri': 'http://example.org',
100100
})
101101
url = "{url}?{qs}".format(url=reverse('oauth2_provider:authorize'), qs=query_string)
102102

@@ -133,7 +133,7 @@ def test_pre_auth_valid_client(self):
133133
'response_type': 'code',
134134
'state': 'random_state_string',
135135
'scope': 'read write',
136-
'redirect_uri': 'http://example.it',
136+
'redirect_uri': 'http://example.org',
137137
})
138138
url = "{url}?{qs}".format(url=reverse('oauth2_provider:authorize'), qs=query_string)
139139

@@ -144,7 +144,7 @@ def test_pre_auth_valid_client(self):
144144
self.assertIn("form", response.context)
145145

146146
form = response.context["form"]
147-
self.assertEqual(form['redirect_uri'].value(), "http://example.it")
147+
self.assertEqual(form['redirect_uri'].value(), "http://example.org")
148148
self.assertEqual(form['state'].value(), "random_state_string")
149149
self.assertEqual(form['scope'].value(), "read write")
150150
self.assertEqual(form['client_id'].value(), self.application.client_id)
@@ -191,7 +191,7 @@ def test_pre_auth_approval_prompt(self):
191191
'response_type': 'code',
192192
'state': 'random_state_string',
193193
'scope': 'read write',
194-
'redirect_uri': 'http://example.it',
194+
'redirect_uri': 'http://example.org',
195195
'approval_prompt': 'auto',
196196
})
197197
url = "{url}?{qs}".format(url=reverse('oauth2_provider:authorize'), qs=query_string)
@@ -219,7 +219,7 @@ def test_pre_auth_approval_prompt_default(self):
219219
'response_type': 'code',
220220
'state': 'random_state_string',
221221
'scope': 'read write',
222-
'redirect_uri': 'http://example.it',
222+
'redirect_uri': 'http://example.org',
223223
})
224224
url = "{url}?{qs}".format(url=reverse('oauth2_provider:authorize'), qs=query_string)
225225
response = self.client.get(url)
@@ -241,7 +241,7 @@ def test_pre_auth_approval_prompt_default_override(self):
241241
'response_type': 'code',
242242
'state': 'random_state_string',
243243
'scope': 'read write',
244-
'redirect_uri': 'http://example.it',
244+
'redirect_uri': 'http://example.org',
245245
})
246246
url = "{url}?{qs}".format(url=reverse('oauth2_provider:authorize'), qs=query_string)
247247
response = self.client.get(url)
@@ -307,14 +307,14 @@ def test_code_post_auth_allow(self):
307307
'client_id': self.application.client_id,
308308
'state': 'random_state_string',
309309
'scope': 'read write',
310-
'redirect_uri': 'http://example.it',
310+
'redirect_uri': 'http://example.org',
311311
'response_type': 'code',
312312
'allow': True,
313313
}
314314

315315
response = self.client.post(reverse('oauth2_provider:authorize'), data=form_data)
316316
self.assertEqual(response.status_code, 302)
317-
self.assertIn('http://example.it?', response['Location'])
317+
self.assertIn('http://example.org?', response['Location'])
318318
self.assertIn('state=random_state_string', response['Location'])
319319
self.assertIn('code=', response['Location'])
320320

@@ -328,7 +328,7 @@ def test_code_post_auth_deny(self):
328328
'client_id': self.application.client_id,
329329
'state': 'random_state_string',
330330
'scope': 'read write',
331-
'redirect_uri': 'http://example.it',
331+
'redirect_uri': 'http://example.org',
332332
'response_type': 'code',
333333
'allow': False,
334334
}
@@ -347,14 +347,14 @@ def test_code_post_auth_bad_responsetype(self):
347347
'client_id': self.application.client_id,
348348
'state': 'random_state_string',
349349
'scope': 'read write',
350-
'redirect_uri': 'http://example.it',
350+
'redirect_uri': 'http://example.org',
351351
'response_type': 'UNKNOWN',
352352
'allow': True,
353353
}
354354

355355
response = self.client.post(reverse('oauth2_provider:authorize'), data=form_data)
356356
self.assertEqual(response.status_code, 302)
357-
self.assertIn('http://example.it?error', response['Location'])
357+
self.assertIn('http://example.org?error', response['Location'])
358358

359359
def test_code_post_auth_forbidden_redirect_uri(self):
360360
"""
@@ -506,7 +506,7 @@ def get_auth(self):
506506
'client_id': self.application.client_id,
507507
'state': 'random_state_string',
508508
'scope': 'read write',
509-
'redirect_uri': 'http://example.it',
509+
'redirect_uri': 'http://example.org',
510510
'response_type': 'code',
511511
'allow': True,
512512
}
@@ -525,7 +525,7 @@ def test_basic_auth(self):
525525
token_request_data = {
526526
'grant_type': 'authorization_code',
527527
'code': authorization_code,
528-
'redirect_uri': 'http://example.it'
528+
'redirect_uri': 'http://example.org'
529529
}
530530
auth_headers = get_basic_auth_header(self.application.client_id, self.application.client_secret)
531531

@@ -547,7 +547,7 @@ def test_refresh(self):
547547
token_request_data = {
548548
'grant_type': 'authorization_code',
549549
'code': authorization_code,
550-
'redirect_uri': 'http://example.it'
550+
'redirect_uri': 'http://example.org'
551551
}
552552
auth_headers = get_basic_auth_header(self.application.client_id, self.application.client_secret)
553553

@@ -560,7 +560,7 @@ def test_refresh(self):
560560
token_request_data = {
561561
'grant_type': 'authorization_code',
562562
'code': authorization_code,
563-
'redirect_uri': 'http://example.it'
563+
'redirect_uri': 'http://example.org'
564564
}
565565
response = self.client.post(reverse('oauth2_provider:token'), data=token_request_data, **auth_headers)
566566

@@ -591,7 +591,7 @@ def test_refresh_invalidates_old_tokens(self):
591591
token_request_data = {
592592
'grant_type': 'authorization_code',
593593
'code': authorization_code,
594-
'redirect_uri': 'http://example.it'
594+
'redirect_uri': 'http://example.org'
595595
}
596596
auth_headers = get_basic_auth_header(self.application.client_id, self.application.client_secret)
597597

@@ -622,7 +622,7 @@ def test_refresh_no_scopes(self):
622622
token_request_data = {
623623
'grant_type': 'authorization_code',
624624
'code': authorization_code,
625-
'redirect_uri': 'http://example.it'
625+
'redirect_uri': 'http://example.org'
626626
}
627627
auth_headers = get_basic_auth_header(self.application.client_id, self.application.client_secret)
628628

@@ -650,7 +650,7 @@ def test_refresh_bad_scopes(self):
650650
token_request_data = {
651651
'grant_type': 'authorization_code',
652652
'code': authorization_code,
653-
'redirect_uri': 'http://example.it'
653+
'redirect_uri': 'http://example.org'
654654
}
655655
auth_headers = get_basic_auth_header(self.application.client_id, self.application.client_secret)
656656

@@ -676,7 +676,7 @@ def test_refresh_fail_repeating_requests(self):
676676
token_request_data = {
677677
'grant_type': 'authorization_code',
678678
'code': authorization_code,
679-
'redirect_uri': 'http://example.it'
679+
'redirect_uri': 'http://example.org'
680680
}
681681
auth_headers = get_basic_auth_header(self.application.client_id, self.application.client_secret)
682682

@@ -704,7 +704,7 @@ def test_refresh_repeating_requests_non_rotating_tokens(self):
704704
token_request_data = {
705705
'grant_type': 'authorization_code',
706706
'code': authorization_code,
707-
'redirect_uri': 'http://example.it'
707+
'redirect_uri': 'http://example.org'
708708
}
709709
auth_headers = get_basic_auth_header(self.application.client_id, self.application.client_secret)
710710

@@ -735,7 +735,7 @@ def test_basic_auth_bad_authcode(self):
735735
token_request_data = {
736736
'grant_type': 'authorization_code',
737737
'code': 'BLAH',
738-
'redirect_uri': 'http://example.it'
738+
'redirect_uri': 'http://example.org'
739739
}
740740
auth_headers = get_basic_auth_header(self.application.client_id, self.application.client_secret)
741741

@@ -751,7 +751,7 @@ def test_basic_auth_bad_granttype(self):
751751
token_request_data = {
752752
'grant_type': 'UNKNOWN',
753753
'code': 'BLAH',
754-
'redirect_uri': 'http://example.it'
754+
'redirect_uri': 'http://example.org'
755755
}
756756
auth_headers = get_basic_auth_header(self.application.client_id, self.application.client_secret)
757757

@@ -770,7 +770,7 @@ def test_basic_auth_grant_expired(self):
770770
token_request_data = {
771771
'grant_type': 'authorization_code',
772772
'code': 'BLAH',
773-
'redirect_uri': 'http://example.it'
773+
'redirect_uri': 'http://example.org'
774774
}
775775
auth_headers = get_basic_auth_header(self.application.client_id, self.application.client_secret)
776776

@@ -787,7 +787,7 @@ def test_basic_auth_bad_secret(self):
787787
token_request_data = {
788788
'grant_type': 'authorization_code',
789789
'code': authorization_code,
790-
'redirect_uri': 'http://example.it'
790+
'redirect_uri': 'http://example.org'
791791
}
792792
auth_headers = get_basic_auth_header(self.application.client_id, 'BOOM!')
793793

@@ -804,7 +804,7 @@ def test_basic_auth_wrong_auth_type(self):
804804
token_request_data = {
805805
'grant_type': 'authorization_code',
806806
'code': authorization_code,
807-
'redirect_uri': 'http://example.it'
807+
'redirect_uri': 'http://example.org'
808808
}
809809

810810
user_pass = '{0}:{1}'.format(self.application.client_id, self.application.client_secret)
@@ -826,7 +826,7 @@ def test_request_body_params(self):
826826
token_request_data = {
827827
'grant_type': 'authorization_code',
828828
'code': authorization_code,
829-
'redirect_uri': 'http://example.it',
829+
'redirect_uri': 'http://example.org',
830830
'client_id': self.application.client_id,
831831
'client_secret': self.application.client_secret,
832832
}
@@ -852,7 +852,7 @@ def test_public(self):
852852
token_request_data = {
853853
'grant_type': 'authorization_code',
854854
'code': authorization_code,
855-
'redirect_uri': 'http://example.it',
855+
'redirect_uri': 'http://example.org',
856856
'client_id': self.application.client_id
857857
}
858858

@@ -896,7 +896,7 @@ def test_code_exchange_succeed_when_redirect_uri_match(self):
896896
'client_id': self.application.client_id,
897897
'state': 'random_state_string',
898898
'scope': 'read write',
899-
'redirect_uri': 'http://example.it?foo=bar',
899+
'redirect_uri': 'http://example.org?foo=bar',
900900
'response_type': 'code',
901901
'allow': True,
902902
}
@@ -908,7 +908,7 @@ def test_code_exchange_succeed_when_redirect_uri_match(self):
908908
token_request_data = {
909909
'grant_type': 'authorization_code',
910910
'code': authorization_code,
911-
'redirect_uri': 'http://example.it?foo=bar'
911+
'redirect_uri': 'http://example.org?foo=bar'
912912
}
913913
auth_headers = get_basic_auth_header(self.application.client_id, self.application.client_secret)
914914

@@ -931,7 +931,7 @@ def test_code_exchange_fails_when_redirect_uri_does_not_match(self):
931931
'client_id': self.application.client_id,
932932
'state': 'random_state_string',
933933
'scope': 'read write',
934-
'redirect_uri': 'http://example.it?foo=bar',
934+
'redirect_uri': 'http://example.org?foo=bar',
935935
'response_type': 'code',
936936
'allow': True,
937937
}
@@ -943,7 +943,7 @@ def test_code_exchange_fails_when_redirect_uri_does_not_match(self):
943943
token_request_data = {
944944
'grant_type': 'authorization_code',
945945
'code': authorization_code,
946-
'redirect_uri': 'http://example.it?foo=baraa'
946+
'redirect_uri': 'http://example.org?foo=baraa'
947947
}
948948
auth_headers = get_basic_auth_header(self.application.client_id, self.application.client_secret)
949949

@@ -997,7 +997,7 @@ def test_resource_access_allowed(self):
997997
'client_id': self.application.client_id,
998998
'state': 'random_state_string',
999999
'scope': 'read write',
1000-
'redirect_uri': 'http://example.it',
1000+
'redirect_uri': 'http://example.org',
10011001
'response_type': 'code',
10021002
'allow': True,
10031003
}
@@ -1009,7 +1009,7 @@ def test_resource_access_allowed(self):
10091009
token_request_data = {
10101010
'grant_type': 'authorization_code',
10111011
'code': authorization_code,
1012-
'redirect_uri': 'http://example.it'
1012+
'redirect_uri': 'http://example.org'
10131013
}
10141014
auth_headers = get_basic_auth_header(self.application.client_id, self.application.client_secret)
10151015

@@ -1053,7 +1053,7 @@ def test_pre_auth_default_scopes(self):
10531053
'client_id': self.application.client_id,
10541054
'response_type': 'code',
10551055
'state': 'random_state_string',
1056-
'redirect_uri': 'http://example.it',
1056+
'redirect_uri': 'http://example.org',
10571057
})
10581058
url = "{url}?{qs}".format(url=reverse('oauth2_provider:authorize'), qs=query_string)
10591059

@@ -1064,7 +1064,7 @@ def test_pre_auth_default_scopes(self):
10641064
self.assertIn("form", response.context)
10651065

10661066
form = response.context["form"]
1067-
self.assertEqual(form['redirect_uri'].value(), "http://example.it")
1067+
self.assertEqual(form['redirect_uri'].value(), "http://example.org")
10681068
self.assertEqual(form['state'].value(), "random_state_string")
10691069
self.assertEqual(form['scope'].value(), 'read')
10701070
self.assertEqual(form['client_id'].value(), self.application.client_id)

0 commit comments

Comments
 (0)