コード例 #1
0
    def test_should_parse_the_params_and_call_the_search(self):
        from search_artists.views import search
        searcher_mock = self.create_patch('%s.search_by_age' % searcher_module,
                                          return_value=fake_data)

        response = search(self.request)

        searcher_mock.assert_called_with(10, 20, sorterKlass=MedianSorter)
コード例 #2
0
    def test_should_parse_the_params_and_call_the_search(self):
        from search_artists.views import search
        searcher_mock = self.create_patch(
            '%s.search_by_age' % searcher_module,
            return_value=fake_data)

        response = search(self.request)

        searcher_mock.assert_called_with(10, 20, sorterKlass=MedianSorter)
コード例 #3
0
    def test_response_dict(self):
        from search_artists.views import search
        searcher_mock = self.create_patch('%s.search_by_age' % searcher_module,
                                          return_value=fake_data)

        response = search(self.request)

        self.assertEqual(
            response, {
                'artists': fake_data,
                'artists_json': json.dumps(fake_data, indent=4),
                'minAge': 10,
                'maxAge': 20
            })
コード例 #4
0
    def test_response_dict(self):
        from search_artists.views import search
        searcher_mock = self.create_patch(
            '%s.search_by_age' % searcher_module,
            return_value=fake_data)

        response = search(self.request)

        self.assertEqual(response, {
            'artists': fake_data,
            'artists_json': json.dumps(fake_data, indent=4),
            'minAge': 10,
            'maxAge': 20
            })