Skip to content

Commit 14e0236

Browse files
committed
adding sensitive labels for text areas
1 parent ef5e3cf commit 14e0236

File tree

2 files changed

+32
-43
lines changed

2 files changed

+32
-43
lines changed

src/edit_python_pe/main.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,10 @@ def on_mount(self) -> None:
6060
self.city_input = Input(placeholder="Ciudad")
6161
self.homepage_input = Input(placeholder="Página personal")
6262

63-
self.who_area = TextArea(text="¿Quién eres y a qué te dedicas?")
64-
self.python_area = TextArea(text="¿Cómo programas en Python?")
65-
self.contributions_area = TextArea(
66-
text="¿Tienes algún aporte a la comunidad de Python?"
67-
)
68-
self.availability_area = TextArea(
69-
text="¿Estás disponible para hacer mentoring, consultorías, charlas?"
70-
)
63+
self.who_area = TextArea()
64+
self.python_area = TextArea()
65+
self.contributions_area = TextArea()
66+
self.availability_area = TextArea()
7167

7268
self.social_container = Vertical()
7369
self.alias_container = Vertical()
@@ -95,9 +91,27 @@ def on_mount(self) -> None:
9591

9692
self.form_container.mount(self.city_input)
9793
self.form_container.mount(self.homepage_input)
94+
self.form_container.mount(
95+
Static("¿Quién eres y a qué te dedicas?", classes="subheader")
96+
)
9897
self.form_container.mount(self.who_area)
98+
self.form_container.mount(
99+
Static("¿Cómo programas en Python?", classes="subheader")
100+
)
99101
self.form_container.mount(self.python_area)
102+
self.form_container.mount(
103+
Static(
104+
"¿Tienes algún aporte a la comunidad de Python?",
105+
classes="subheader",
106+
)
107+
)
100108
self.form_container.mount(self.contributions_area)
109+
self.form_container.mount(
110+
Static(
111+
"¿Estás disponible para hacer mentoring, consultorías, charlas?",
112+
classes="subheader",
113+
)
114+
)
101115
self.form_container.mount(self.availability_area)
102116

103117
self.form_button_bar = Horizontal(
@@ -131,14 +145,10 @@ def clear_form(self) -> None:
131145
self.email_input.value = ""
132146
self.city_input.value = ""
133147
self.homepage_input.value = ""
134-
self.who_area.text = "¿Quién eres y a qué te dedicas?"
135-
self.python_area.text = "¿Cómo programas en Python?"
136-
self.contributions_area.text = (
137-
"¿Tienes algún aporte a la comunidad de Python?"
138-
)
139-
self.availability_area.text = (
140-
"¿Estás disponible para hacer mentoring, consultorías, charlas?"
141-
)
148+
self.who_area.text = ""
149+
self.python_area.text = ""
150+
self.contributions_area.text = ""
151+
self.availability_area.text = ""
142152

143153
for soc in self.social_entries:
144154
soc.remove()

tests/test_member_app.py

Lines changed: 6 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
sys.path.insert(
99
0, os.path.abspath(os.path.join(os.path.dirname(__file__), "../src"))
1010
)
11-
from edit_python_pe.main import MemberApp
11+
from edit_python_pe.main import MemberApp, fork_repo, get_repo, main
1212

1313

1414
class TestMemberApp(unittest.TestCase):
@@ -27,7 +27,7 @@ def setUp(self):
2727
self.app.social_index = 0
2828
self.app.alias_index = 0
2929

30-
# Mock UI elements and REPO_PATH
30+
# Mock UI elements
3131
# Use simple stub classes for input widgets and text areas
3232
class StubInput:
3333
def __init__(self):
@@ -45,7 +45,6 @@ def __init__(self):
4545
self.app.python_area = StubTextArea()
4646
self.app.contributions_area = StubTextArea()
4747
self.app.availability_area = StubTextArea()
48-
self.app.REPO_PATH = "test_repo"
4948

5049
# Patch remove method for entries to avoid Textual lifecycle errors
5150
# Use stub classes for entries with .remove() method
@@ -116,19 +115,15 @@ class DummyEvent:
116115
self.assertEqual(self.app.email_input.value, "")
117116
self.assertEqual(self.app.city_input.value, "")
118117
self.assertEqual(self.app.homepage_input.value, "")
119-
self.assertEqual(
120-
self.app.who_area.text, "¿Quién eres y a qué te dedicas?"
121-
)
122-
self.assertEqual(
123-
self.app.python_area.text, "¿Cómo programas en Python?"
124-
)
118+
self.assertEqual(self.app.who_area.text, "")
119+
self.assertEqual(self.app.python_area.text, "")
125120
self.assertEqual(
126121
self.app.contributions_area.text,
127-
"¿Tienes algún aporte a la comunidad de Python?",
122+
"",
128123
)
129124
self.assertEqual(
130125
self.app.availability_area.text,
131-
"¿Estás disponible para hacer mentoring, consultorías, charlas?",
126+
"",
132127
)
133128
self.assertEqual(len(self.app.social_entries), 0)
134129
self.assertEqual(len(self.app.alias_entries), 0)
@@ -158,7 +153,6 @@ def test_save_member_edit_no_pr(self):
158153
from unittest.mock import MagicMock, patch
159154

160155
app = self.app
161-
app.REPO_PATH = "/tmp/testrepo"
162156
app.current_file = "existing_member.md"
163157
app.token = "fake-token"
164158
app.forked_repo = MagicMock()
@@ -213,7 +207,6 @@ def test_save_member_edit(self):
213207
from unittest.mock import MagicMock, patch
214208

215209
app = self.app
216-
app.REPO_PATH = "/tmp/testrepo"
217210
app.current_file = "existing_member.md"
218211
app.token = "fake-token"
219212
app.forked_repo = MagicMock()
@@ -275,7 +268,6 @@ def test_save_member_new(self):
275268
from unittest.mock import MagicMock, patch
276269

277270
app = self.app
278-
app.REPO_PATH = "/tmp/testrepo"
279271
app.current_file = None
280272
app.token = "fake-token"
281273
app.forked_repo = MagicMock()
@@ -326,7 +318,6 @@ def test_save_member_error_handling(self):
326318
from unittest.mock import MagicMock, patch
327319

328320
app = self.app
329-
app.REPO_PATH = "/tmp/testrepo"
330321
app.current_file = None
331322
app.token = "fake-token"
332323
app.forked_repo = MagicMock()
@@ -462,12 +453,6 @@ def stub_add_alias_entry():
462453
self.assertGreaterEqual(len(self.app.social_entries), 1)
463454

464455

465-
# Test for get_repo function
466-
import builtins
467-
468-
from edit_python_pe.main import get_repo
469-
470-
471456
class TestGetRepo(unittest.TestCase):
472457
@patch("edit_python_pe.main.getpass.getpass", return_value="valid-token")
473458
@patch("edit_python_pe.main.Github")
@@ -501,9 +486,6 @@ def test_get_repo_github_exception(self, mock_github, mock_getpass):
501486
get_repo()
502487

503488

504-
from edit_python_pe.main import fork_repo
505-
506-
507489
class TestForkRepo(unittest.TestCase):
508490
@patch("edit_python_pe.main.user_data_dir", return_value="/tmp/testrepo")
509491
@patch("edit_python_pe.main.os.path.exists", return_value=False)
@@ -533,9 +515,6 @@ def test_fork_repo_no_clone_if_exists(
533515
mock_forked_repo = MagicMock()
534516

535517

536-
from edit_python_pe.main import main
537-
538-
539518
class TestMainFunction(unittest.TestCase):
540519
@patch("edit_python_pe.main.get_repo")
541520
@patch("edit_python_pe.main.fork_repo")

0 commit comments

Comments
 (0)