Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump canonicalwebteam.search version #4853

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# App dependencies
canonicalwebteam.flask-base==1.1.0
canonicalwebteam.flask-base==2.0.0
canonicalwebteam.candid==0.9.0
canonicalwebteam.discourse==5.6.1
canonicalwebteam.blog==6.4.2
canonicalwebteam.search==1.3.0
canonicalwebteam.search==2.1.0
canonicalwebteam.image-template==1.3.1
canonicalwebteam.store-api==5.0.0
canonicalwebteam.launchpad==0.9.0
Expand Down
4 changes: 1 addition & 3 deletions tests/first_snap/tests_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@


class FirstSnap(TestCase):
render_templates = False

def create_app(self):
app = create_app(testing=True)
app.secret_key = "secret_key"
Expand Down Expand Up @@ -100,7 +98,7 @@ def test_get_build_and_test_snap_name(self):
assert response.status_code == 200
self.assert_context("language", "python")
self.assert_context("os", "linux-auto")
self.assert_context("snap_name", "test-snap-name-python")
self.assert_context("snap_name", "test-offlineimap-{name}")
self.assert_template_used("first-snap/build-and-test.html")

def test_get_build_and_test_404_language(self):
Expand Down
6 changes: 2 additions & 4 deletions tests/login/tests_login_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@


class LoginHandlerTest(TestCase):
render_templates = False

def setUp(self):
self.api_url = "https://dashboard.snapcraft.io/dev/api/acl/"
self.endpoint_url = "/login"
Expand Down Expand Up @@ -38,7 +36,7 @@ def test_redirect_user_logged_in_next_url(self):

response = self.client.get(self.endpoint_url + "?next=/test")
assert response.status_code == 302
self.assertEqual("http://localhost/test", response.location)
self.assertEqual("/test", response.location)

@responses.activate
def test_login_handler_redirect(self):
Expand Down Expand Up @@ -82,7 +80,7 @@ def test_login_api_401(self):

assert len(responses.calls) == 1
assert response.status_code == 302
self.assertEqual("http://localhost/logout", response.location)
self.assertEqual("/logout", response.location)

@responses.activate
def test_login_connection_error(self):
Expand Down
14 changes: 4 additions & 10 deletions tests/publisher/endpoint_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ class BaseTestCases:
"""

class BaseAppTesting(TestCase):
render_templates = False

def setUp(self, snap_name, api_url, endpoint_url):
self.snap_name = snap_name
self.api_url = api_url
Expand All @@ -37,7 +35,7 @@ def create_app(self):
return app

def _get_location(self):
return "http://localhost{}".format(self.endpoint_url)
return "{}".format(self.endpoint_url)

def _log_in(self, client):
"""Emulates test client login in the store.
Expand Down Expand Up @@ -93,7 +91,7 @@ def test_access_not_logged_in(self):

self.assertEqual(302, response.status_code)
self.assertEqual(
"http://localhost/login?next={}".format(self.endpoint_url),
"/login?next={}".format(self.endpoint_url),
response.location,
)

Expand Down Expand Up @@ -360,9 +358,7 @@ def test_account_not_signed_agreement_logged_in(self):
self.check_call_by_api_url(responses.calls)

self.assertEqual(302, response.status_code)
self.assertEqual(
"http://localhost/account/agreement", response.location
)
self.assertEqual("/account/agreement", response.location)

@responses.activate
def test_account_no_username_logged_in(self):
Expand Down Expand Up @@ -398,6 +394,4 @@ def test_account_no_username_logged_in(self):
self.check_call_by_api_url(responses.calls)

self.assertEqual(302, response.status_code)
self.assertEqual(
"http://localhost/account/username", response.location
)
self.assertEqual("/account/username", response.location)
2 changes: 1 addition & 1 deletion tests/publisher/snaps/tests_post_close_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_page_not_found(self):
self.assert_template_used("404.html")

def test_post_no_data(self):
response = self.client.post(self.endpoint_url)
response = self.client.post(self.endpoint_url, json={})

assert response.status_code == 400
assert response.get_json() == {}
Expand Down
2 changes: 1 addition & 1 deletion tests/publisher/snaps/tests_post_default_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def test_page_not_found(self):
self.assert_template_used("404.html")

def test_post_no_data(self):
response = self.client.post(self.endpoint_url)
response = self.client.post(self.endpoint_url, json={})

assert response.status_code == 400
assert response.get_json() == {}
Expand Down
2 changes: 1 addition & 1 deletion tests/publisher/snaps/tests_post_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_page_not_found(self):

@responses.activate
def test_post_no_data(self):
response = self.client.post(self.endpoint_url)
response = self.client.post(self.endpoint_url, json={})

assert response.status_code == 400
assert response.get_json() == {"errors": ["No changes were submitted"]}
Expand Down
2 changes: 1 addition & 1 deletion tests/publisher/tests_account_logout.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ def test_logout(self):

self.assertEqual(302, response.status_code)

self.assertEqual("http://localhost/", response.location)
self.assertEqual("/", response.location)
6 changes: 2 additions & 4 deletions tests/publisher/tests_agreement.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ def test_post_agreement_on(self):
self.assertEqual(b'{"latest_tos_accepted": true}', called.request.body)

self.assertEqual(302, response.status_code)
self.assertEqual("http://localhost/account/", response.location)
self.assertEqual("/account/", response.location)

@responses.activate
def test_post_agreement_off(self):
response = self.client.post(self.endpoint_url, data={"i_agree": "off"})

self.assertEqual(302, response.status_code)
self.assertEqual(
"http://localhost/account/agreement", response.location
)
self.assertEqual("/account/agreement", response.location)
20 changes: 6 additions & 14 deletions tests/publisher/tests_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ def test_cache_disabled(self):


class PublisherPage(TestCase):
render_templates = False

def create_app(self):
app = create_app(testing=True)
app.secret_key = "secret_key"
Expand All @@ -56,7 +54,7 @@ def create_app(self):

def test_account(self):
local_redirect = self.client.get("/account")
redirect_url = "http://localhost/login?next=/account"
redirect_url = "/login?next=/account"
assert local_redirect.status_code == 302
assert local_redirect.headers.get("Location") == redirect_url

Expand Down Expand Up @@ -90,16 +88,12 @@ def _log_in(self, client):
def test_username_not_logged_in(self):
response = self.client.get("/account/username")
self.assertEqual(302, response.status_code)
self.assertEqual(
"http://localhost/login?next=/account/username", response.location
)
self.assertEqual("/login?next=/account/username", response.location)

def test_account_not_logged_in(self):
response = self.client.get("/account")
self.assertEqual(302, response.status_code)
self.assertEqual(
"http://localhost/login?next=/account", response.location
)
self.assertEqual("/login?next=/account", response.location)

# /account endpoint
# ===
Expand All @@ -108,7 +102,7 @@ def test_account_redirect(self):
self._log_in(self.client)
response = self.client.get("/account")
self.assertEqual(302, response.status_code)
self.assertEqual("http://localhost/snaps", response.location)
self.assertEqual("/snaps", response.location)

# /account/username endpoint
# ===
Expand Down Expand Up @@ -147,7 +141,7 @@ def test_post_username_logged_in(self):
self.assertEqual(b'{"short_namespace": "toto"}', called.request.body)

self.assertEqual(302, response.status_code)
self.assertEqual("http://localhost/account/", response.location)
self.assertEqual("/account/", response.location)

@responses.activate
def test_post_no_username_logged_in(self):
Expand All @@ -157,9 +151,7 @@ def test_post_no_username_logged_in(self):
self.assertEqual(0, len(responses.calls))

self.assertEqual(302, response.status_code)
self.assertEqual(
"http://localhost/account/username", response.location
)
self.assertEqual("/account/username", response.location)

@responses.activate
def test_post_bad_username_logged_in(self):
Expand Down
14 changes: 7 additions & 7 deletions tests/publisher/tests_register_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def test_post_snap_name(self):
self.assertEqual(b'{"snap_name": "test-snap"}', called.request.body)

assert response.status_code == 302
self.assertEqual(response.location, "http://localhost/account/")
self.assertEqual(response.location, "/account/")

@responses.activate
def test_post_store(self):
Expand All @@ -170,7 +170,7 @@ def test_post_store(self):
self.assertIn(b'"store": "store"', called.request.body)

assert response.status_code == 302
self.assertEqual(response.location, "http://localhost/account/")
self.assertEqual(response.location, "/account/")

@responses.activate
def test_post_private(self):
Expand All @@ -189,7 +189,7 @@ def test_post_private(self):
self.assertIn(b'"is_private": true', called.request.body)

assert response.status_code == 302
self.assertEqual(response.location, "http://localhost/account/")
self.assertEqual(response.location, "/account/")

@responses.activate
def test_post_registrant_comment(self):
Expand All @@ -208,7 +208,7 @@ def test_post_registrant_comment(self):
self.assertIn(b'"registrant_comment": "comment"', called.request.body)

assert response.status_code == 302
self.assertEqual(response.location, "http://localhost/account/")
self.assertEqual(response.location, "/account/")

@responses.activate
def test_error_from_api(self):
Expand Down Expand Up @@ -240,7 +240,7 @@ def test_name_already_registered(self):
assert response.status_code == 302
self.assertIn("snap_name=test-snap", response.location)
self.assertIn("is_private=False", response.location)
self.assertIn("http://localhost/register-snap", response.location)
self.assertIn("/register-snap", response.location)

@responses.activate
def test_name_reserved(self):
Expand All @@ -257,7 +257,7 @@ def test_name_reserved(self):
assert response.status_code == 302
self.assertIn("snap_name=test-snap", response.location)
self.assertIn("is_private=False", response.location)
self.assertIn("http://localhost/register-snap", response.location)
self.assertIn("/register-snap", response.location)

@responses.activate
def test_claim_dispute(self):
Expand All @@ -272,7 +272,7 @@ def test_claim_dispute(self):
response = self.client.post(self.endpoint_url, data=self.data)

assert response.status_code == 302
self.assertEqual(response.location, "http://localhost/admin/account")
self.assertEqual(response.location, "/admin/account")

@responses.activate
def test_post_error_user_error(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/publisher/tests_register_name_dispute.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_register_name_dispute_redirect_no_snap_name(self):
responses.add(
responses.GET, self.user_url, json=self.user_payload, status=200
)
response = self.client.get(self.endpoint_url)
response = self.client.get(self.endpoint_url, follow_redirects=True)

self.assertEqual(response.status_code, 302)
self.assertRedirects(response, "/register-snap")
Expand Down
2 changes: 1 addition & 1 deletion tests/publisher/tests_reserved_name_dispute.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_request_reserved_name_redirect_no_snap_name(self):
responses.add(
responses.GET, self.user_url, json=self.user_payload, status=200
)
response = self.client.get(self.endpoint_url)
response = self.client.get(self.endpoint_url, follow_redirects=True)

self.assertEqual(response.status_code, 302)
self.assertRedirects(response, "/register-snap")
10 changes: 3 additions & 7 deletions tests/publisher/tests_username.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,18 @@ def test_post_username(self):
self.assertEqual(b'{"short_namespace": "toto"}', called.request.body)

self.assertEqual(302, response.status_code)
self.assertEqual("http://localhost/account/", response.location)
self.assertEqual("/account/", response.location)

@responses.activate
def test_post_username_empty(self):
response = self.client.post(self.endpoint_url, data={"username": ""})

self.assertEqual(302, response.status_code)
self.assertEqual(
"http://localhost/account/username", response.location
)
self.assertEqual("/account/username", response.location)

@responses.activate
def test_post_no_data(self):
response = self.client.post(self.endpoint_url, data={})

self.assertEqual(302, response.status_code)
self.assertEqual(
"http://localhost/account/username", response.location
)
self.assertEqual("/account/username", response.location)
2 changes: 0 additions & 2 deletions tests/snapcraft/tests_public.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@


class StorePage(TestCase):
render_templates = False

def create_app(self):
app = create_app(testing=True)
app.secret_key = "secret_key"
Expand Down
2 changes: 0 additions & 2 deletions tests/store/tests_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@


class GetDetailsPageTest(TestCase):
render_templates = False

def setUp(self):
self.snap_name = "toto"
self.api_url = "".join(
Expand Down
2 changes: 0 additions & 2 deletions tests/store/tests_distro_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@


class GetDistroPageTest(TestCase):
render_templates = False

snap_payload = {
"snap-id": "id",
"name": "snapName",
Expand Down
2 changes: 0 additions & 2 deletions tests/store/tests_embedded_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@


class GetEmbeddedCardTest(TestCase):
render_templates = False

snap_payload = {
"snap-id": "id",
"name": "snapName",
Expand Down
2 changes: 0 additions & 2 deletions tests/store/tests_github_badge.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@


class GetGitHubBadgeTest(TestCase):
render_templates = False

snap_payload = {
"snap-id": "id",
"name": "snapName",
Expand Down
2 changes: 0 additions & 2 deletions tests/store/tests_publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@


class GetPublisherPageTest(TestCase):
render_templates = False

def setUp(self):
self.publisher = "jetbrains"
self.api_url = "".join(
Expand Down
2 changes: 0 additions & 2 deletions tests/tests_badge_counter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@


class TestsBadgePrometheusCounter(TestCase):
render_templates = False

def setUp(self):
self.endpoint_url = "/static/images/badges/en/snap-store-black.svg"
badge_counter._value.set(0.0)
Expand Down
1 change: 1 addition & 0 deletions webapp/docs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def init_docs(app, url_prefix):
"/docs/search",
"docs-search",
build_search_view(
app=app,
session=session,
site="snapcraft.io/docs",
template_path="docs/search.html",
Expand Down
Loading