-
Notifications
You must be signed in to change notification settings - Fork 52
Feature/add analytics #387
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| #!/bin/sh | ||
|
|
||
| # Checking if current tag matches the package version | ||
| current_tag=$(echo $GITHUB_REF | cut -d '/' -f 3 | sed -r 's/^v//') | ||
| file_tag=$(grep '__version__ =' meilisearch/version.py | cut -d '=' -f 2- | tr -d ' ' | tr -d '"' | tr -d ',') | ||
| if [ "$current_tag" != "$file_tag" ]; then | ||
| echo "Error: the current tag does not match the version in package file(s)." | ||
| echo "$current_tag vs $file_tag" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo 'OK' | ||
| exit 0 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from __future__ import annotations | ||
|
|
||
| __version__ = "0.12.9" | ||
|
|
||
|
|
||
| def qualified_version() -> str: | ||
| """Get the qualified version of this module.""" | ||
|
|
||
| return f"Meilisearch DocsScraper (v{__version__})" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MASTER_KEY = "masterKey" | ||
| BASE_URL = "http://127.0.0.1:7700" | ||
|
|
||
| DEFAULT_INDEX = 'index_uid' | ||
|
|
||
| DEFAULT_DATA_DELETE = { | ||
| "taskUid": 1, | ||
| "indexUid": DEFAULT_INDEX, | ||
| "status": "enqueued", | ||
| "type": "indexDeletion", | ||
| "enqueuedAt": "2023-03-30T13:24:01.789654093Z" | ||
| } | ||
| DEFAULT_DATA_PATCH = { | ||
| "taskUid": 1, | ||
| "indexUid": DEFAULT_INDEX, | ||
| "status": "enqueued", | ||
| "type": "settingsUpdate", | ||
| "enqueuedAt": "2023-03-30T13:24:01.789654093Z" | ||
| } | ||
|
|
||
| DEFAULT_ACCEPTED_STATUS = 202 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| # coding: utf-8 | ||
| import json | ||
| from unittest.mock import patch | ||
|
|
||
| import requests | ||
|
|
||
| from scraper.src.meilisearch_helper import MeiliSearchHelper | ||
| from scraper.src.config.version import __version__ | ||
| from tests.meilisearch_helper import common | ||
|
|
||
|
|
||
| class TestMeilisearchHelper: | ||
| @patch("requests.delete") | ||
| @patch("requests.patch") | ||
| def test_use_meilisearch_default(self, mock_delete, mock_patch): | ||
| mock_delete.configure_mock(__name__="delete") | ||
| mock_response = requests.models.Response() | ||
| mock_response.status_code = common.DEFAULT_ACCEPTED_STATUS | ||
| mock_response._content = json.dumps(common.DEFAULT_DATA_DELETE).encode('utf-8') | ||
| mock_delete.return_value = mock_response | ||
|
|
||
| mock_patch.configure_mock(__name__="patch") | ||
| mock_response = requests.models.Response() | ||
| mock_response.status_code = common.DEFAULT_ACCEPTED_STATUS | ||
| mock_response._content = json.dumps(common.DEFAULT_DATA_DELETE).encode('utf-8') | ||
| mock_patch.return_value = mock_response | ||
| """ Should set the `User-Agent` doscraper by default """ | ||
| # When | ||
| actual = MeiliSearchHelper( | ||
| common.BASE_URL, | ||
| common.MASTER_KEY, | ||
| common.DEFAULT_INDEX, | ||
| MeiliSearchHelper.SETTINGS | ||
| ) | ||
|
|
||
| # Then | ||
| assert actual.meilisearch_client.http.headers['User-Agent'] == f"Meilisearch Python (v0.27.0);Meilisearch DocsScraper (v{__version__})" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fact that all these headers are not separated by a white space makes matching harder on our analytics tools no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good question, I have no idea, but I think @brunoocasali will be better able to answer, as these entries will be used through Amplitude. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope @bidoubiwa it is correct like this, they use the More about it here in this comment: meilisearch/integration-guides#150 (comment) |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # coding: utf-8 | ||
| import re | ||
|
|
||
| from scraper.src.config.version import __version__ | ||
|
|
||
|
|
||
| class TestInit: | ||
| def test_get_version(self): | ||
| assert re.match(r"^(\d+\.)?(\d+\.)?(\*|\d+)$", __version__) | ||
alallema marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.