Skip to content

Commit

Permalink
Testing variable highlight and preview
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Jul 21, 2024
1 parent 1c34986 commit 2d34d22
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 1 deletion.
Binary file modified .coverage
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: get one
description: Retrieve one todo
url: https://jsonplaceholder.typicode.com/todos/1
url: https://jsonplaceholder.typicode.com/todos/$TODO_ID
headers:
- name: Content-Type
value: application/json
Expand Down
1 change: 1 addition & 0 deletions tests/sample-envs/sample_base.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
POST_ID=1
USER_ID=2
TODO_ID=1
FILE="base"
ONLY_BASE=true
18 changes: 18 additions & 0 deletions tests/test_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

from textual.pilot import Pilot
from textual.widgets import Input, TextArea
from posting.__main__ import make_posting

TEST_DIR = Path(__file__).parent
CONFIG_DIR = TEST_DIR / "sample-configs"
ENV_DIR = TEST_DIR / "sample-envs"
SAMPLE_COLLECTIONS = TEST_DIR / "sample-collections"
POSTING_MAIN = TEST_DIR / "posting_snapshot_app.py"

Expand Down Expand Up @@ -404,3 +406,19 @@ async def run_before(pilot: Pilot):
assert snap_compare(
POSTING_MAIN, run_before=run_before, terminal_size=(118, 34)
)

def test_resolved_variables_highlight_and_preview(self, snap_compare):
"""Check that the resolved variables are highlighted in the URL
and the value is shown below."""

env_path = str((ENV_DIR / "sample_base.env").resolve())
app = make_posting(
collection=SAMPLE_COLLECTIONS / "jsonplaceholder" / "todos",
env=(env_path,),
)

async def run_before(pilot: Pilot):
await pilot.press("j", "j", "enter")
await pilot.press("ctrl+l")

assert snap_compare(app, run_before=run_before)

0 comments on commit 2d34d22

Please sign in to comment.