Skip to content

Commit

Permalink
chore(release): version 2.7.0
Browse files Browse the repository at this point in the history
[no ci]
  • Loading branch information
ddkasa committed Nov 2, 2024
2 parents eedbcc2 + 71e2d22 commit f11f37d
Show file tree
Hide file tree
Showing 18 changed files with 328 additions and 52 deletions.
22 changes: 22 additions & 0 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@

---

### **Refresh** <sup>5</sup>

- Description: Refresh a single tracker.
- Usage: `tgl refresh`
- Aliases: refresh, re, update

---

### **Projects**

- Description: Display a list of subcommands related to projects.
Expand Down Expand Up @@ -147,6 +155,12 @@
- Usage: `tgl project delete`
- Aliases: delete, rm, d, del

##### **Refresh** <sup>5</sup>

- Description: Refresh a single project model.
- Usage: `tgl project refresh`
- Aliases: refresh, re, update

---

### **Clients**
Expand Down Expand Up @@ -185,6 +199,12 @@
- Usage: `tgl client delete`
- Aliases: delete, rm, d, del, remove

##### **Refresh** <sup>5</sup>

- Description: Refresh a single client model.
- Usage: `tgl client refresh`
- Aliases: refresh, re, update

---

### **Tags**
Expand Down Expand Up @@ -278,3 +298,5 @@
<sup>3</sup> _Will provide a list of older clients as pre fill options._

<sup>4</sup> _Will provide a list of older tags as pre fill options._

<sup>5</sup> _Will not appear unless a direct match._
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from ulauncher_toggl_extension.utils import ensure_import

ensure_import("toggl_api", "toggl-api-wrapper", "1.2.0")
ensure_import("toggl_api", "toggl-api-wrapper", "1.3.1")

from ulauncher_toggl_extension.extension import TogglExtension # noqa: E402

Expand Down
18 changes: 9 additions & 9 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ readme = "README.md"
python = "^3.10"
pycairo = "^1.26.1"
pygobject = "^3.48.2"
toggl-api-wrapper = "^1.1.0"
toggl-api-wrapper = "^1.3.1"

[tool.poetry.group.dev.dependencies]
pytest = "^8.3.3"
Expand Down
21 changes: 9 additions & 12 deletions tests/test_commands/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ def create_tracker(dummy_ext, faker):
model = _find_model(desc, command)
yield model

if _find_model(desc, command) is not None:
command = DeleteCommand(dummy_ext)
command.handle([], model=model)
command = DeleteCommand(dummy_ext)
command.handle([], model=model)


@pytest.fixture
Expand All @@ -60,9 +59,8 @@ def create_project(dummy_ext, faker):
model = _find_model(desc, command)
yield model

if _find_model(desc, command) is not None:
command = DeleteProjectCommand(dummy_ext)
command.handle([], model=model)
command = DeleteProjectCommand(dummy_ext)
command.handle([], model=model)


@pytest.fixture
Expand All @@ -75,9 +73,8 @@ def create_client(dummy_ext, faker):
model = _find_model(desc, command)
yield model

if _find_model(desc, command) is not None:
command = DeleteClientCommand(dummy_ext)
command.handle([], model=model)
command = DeleteClientCommand(dummy_ext)
command.handle([], model=model)


@pytest.fixture
Expand All @@ -89,6 +86,6 @@ def create_tag(dummy_ext, faker):

model = _find_model(desc, command)
yield model
if _find_model(desc, command) is not None:
command = DeleteTagCommand(dummy_ext)
command.handle([], model=model)

command = DeleteTagCommand(dummy_ext)
command.handle([], model=model)
21 changes: 21 additions & 0 deletions tests/test_commands/test_client.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
import pytest
from toggl_api import ClientEndpoint, JSONCache

from ulauncher_toggl_extension.commands.client import (
AddClientCommand,
ClientCommand,
DeleteClientCommand,
EditClientCommand,
ListClientCommand,
RefreshClientCommand,
)


@pytest.mark.integration
def test_refresh_client_command(dummy_ext, create_client, faker):
endpoint = ClientEndpoint(
dummy_ext.workspace_id,
dummy_ext.auth,
JSONCache(dummy_ext.cache_path),
)
old_name = create_client.name
create_client.name = faker.name()
endpoint.cache.update_entries(create_client)

assert endpoint.cache.find_entry(create_client).name == create_client.name

cmd = RefreshClientCommand(dummy_ext)
cmd.handle([], model=create_client)

assert endpoint.cache.find_entry(create_client).name == old_name


@pytest.mark.unit
def test_client_subcommand(dummy_ext):
cmd = ClientCommand(dummy_ext)
Expand Down
23 changes: 23 additions & 0 deletions tests/test_commands/test_project.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
import pytest
from toggl_api import JSONCache, ProjectEndpoint

from ulauncher_toggl_extension.commands.project import (
AddProjectCommand,
DeleteProjectCommand,
EditProjectCommand,
ListProjectCommand,
ProjectCommand,
RefreshProjectCommand,
)


@pytest.mark.integration
def test_refresh_project_command(dummy_ext, create_project, faker):
endpoint = ProjectEndpoint(
dummy_ext.workspace_id,
dummy_ext.auth,
JSONCache(dummy_ext.cache_path),
)
old_name = create_project.name
create_project.name = faker.name()
endpoint.cache.update_entries(create_project)
endpoint.cache.commit()

cmd = RefreshProjectCommand(dummy_ext)

assert endpoint.cache.find_entry(create_project).name == create_project.name

cmd.handle([], model=create_project)

assert endpoint.cache.find_entry(create_project).name == old_name


@pytest.mark.unit
def test_project_subcommand(dummy_ext):
cmd = ProjectCommand(dummy_ext)
Expand Down
22 changes: 22 additions & 0 deletions tests/test_commands/test_tracker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import sys
from threading import _DummyThread
import time
from datetime import datetime, timezone
from functools import partial
Expand All @@ -18,6 +19,7 @@
StartCommand,
StopCommand,
)
from ulauncher_toggl_extension.commands.tracker import RefreshCommand


@pytest.mark.integration
Expand Down Expand Up @@ -195,3 +197,23 @@ def test_stop_command(dummy_ext, create_tracker, helper):
find = helper(create_tracker.name, cmd)
assert isinstance(find, TogglTracker)
assert isinstance(find.stop, datetime)


@pytest.mark.integration
def test_refresh_command(dummy_ext, create_tracker, faker):
endpoint = TrackerEndpoint(
dummy_ext.workspace_id,
dummy_ext.auth,
JSONCache(dummy_ext.cache_path),
)
old_name = create_tracker.name
create_tracker.name = faker.name()
endpoint.cache.update_entries(create_tracker)

cmd = RefreshCommand(dummy_ext)

assert endpoint.cache.find_entry(create_tracker).name == create_tracker.name

cmd.handle([], model=create_tracker)

assert endpoint.cache.find_entry(create_tracker).name == old_name
2 changes: 1 addition & 1 deletion ulauncher_toggl_extension/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "2.6.3"
__version__ = "2.7.0"
47 changes: 26 additions & 21 deletions ulauncher_toggl_extension/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,40 @@
- ActionEnum
Classes:
- CurrentTracker
- CurrentTrackerCommand
- ContinueCommand
- StartCommand
- AddCommand
- DeleteCommand
- EditCommand
- StopCommand
- ListTrackerCommand
- RefreshCommand
- Search Trackers (Not implemented yet)
- ProjectCommands
- List Projects
- Add Project
- Edit Project
- Delete Project
- ProjectCommand
- ListProjectCommand
- AddProjectCommand
- EditProjectCommand
- DeleteProjectCommand
- RefreshProjectCommand
- Search Projects (Not implemented yet)
- ClientCommands
- List Clients
- Add Client
- Edit Client
- Delete Client
- ClientCommand
- ListClientCommand
- AddClientCommand
- EditClientCommand
- DeleteClientCommand
- RefreshClientCommand
- Search Clients (Not implemented yet)
- TagCommands:
- List Tags
- Add Tag
- Edit Tag
- Delete Tag
- Search Tags (Not implemented yet)
- ReportCommands:
- Daily Report
- Weekly Report
- Monthly Report
- TagCommand:
- ListTagCommand
- AddTagCommand
- EditTagCommand
- DeleteTagCommand
- SearchTags (Not implemented yet)
- ReportCommand:
- DailyReportCommand
- WeeklyReportCommand
- MonthlyReportCommand
"""

from .client import AddClientCommand, ClientCommand, DeleteClientCommand
Expand All @@ -56,6 +59,7 @@
DeleteCommand,
EditCommand,
ListCommand,
RefreshCommand,
StartCommand,
StopCommand,
)
Expand All @@ -79,6 +83,7 @@
"ListCommand",
"ProjectCommand",
"QueryParameters",
"RefreshCommand",
"ReportCommand",
"StartCommand",
"StopCommand",
Expand Down
Loading

0 comments on commit f11f37d

Please sign in to comment.