Exemplo n.º 1
0
 def test_returns_false_when_kwargs_unmatched(self, mocked_resolve):
     url_name = 'test_url'
     page_slug = 'test_slug'
     mocked_resolve.url_name = url_name
     mocked_resolve.kwargs = {
         'page_slug': 'slug_test',
     }
     mocked_resolve.return_value = mocked_resolve
     matches = current_url_equals(self.context, url_name,
                                  page_slug=page_slug)
     path = self.context.get('request').path
     mocked_resolve.assert_called_once_with(path)
     self.assertFalse(matches)
Exemplo n.º 2
0
 def test_returns_false_when_kwargs_unmatched(self, mocked_resolve):
     url_name = 'test_url'
     page_slug = 'test_slug'
     mocked_resolve.url_name = url_name
     mocked_resolve.kwargs = {
         'page_slug': 'slug_test',
     }
     mocked_resolve.return_value = mocked_resolve
     matches = current_url_equals(self.context, url_name,
                                  page_slug=page_slug)
     path = self.context.get('request').path
     mocked_resolve.assert_called_once_with(path)
     self.assertFalse(matches)
Exemplo n.º 3
0
 def test_returns_false_when_context_invalid(self):
     context = mock.Mock
     url_name = self.url_name
     matches = current_url_equals(context, url_name)
     self.assertFalse(matches)
Exemplo n.º 4
0
 def test_returns_false_when_current_path_not_resolved(self):
     self.request.path = '/invalid-!@#-path'
     url_name = 'test'
     matches = current_url_equals(self.context, url_name)
     self.assertFalse(matches)
Exemplo n.º 5
0
 def test_returns_false_when_resolved_path_not_current_path(self):
     url_name = 'not_login'
     matches = current_url_equals(self.context, url_name)
     self.assertFalse(matches)
Exemplo n.º 6
0
 def test_returns_true_when_resolved_path_equals_current_path(self):
     matches = current_url_equals(self.context, self.url_name)
     self.assertTrue(matches)
Exemplo n.º 7
0
 def test_returns_false_when_context_invalid(self):
     context = mock.Mock
     url_name = self.url_name
     matches = current_url_equals(context, url_name)
     self.assertFalse(matches)
Exemplo n.º 8
0
 def test_returns_false_when_current_path_not_resolved(self):
     self.request.path = '/invalid-!@#-path'
     url_name = 'test'
     matches = current_url_equals(self.context, url_name)
     self.assertFalse(matches)
Exemplo n.º 9
0
 def test_returns_false_when_resolved_path_not_current_path(self):
     url_name = 'not_login'
     matches = current_url_equals(self.context, url_name)
     self.assertFalse(matches)
Exemplo n.º 10
0
 def test_returns_true_when_resolved_path_equals_current_path(self):
     matches = current_url_equals(self.context, self.url_name)
     self.assertTrue(matches)