11from unittest .mock import patch
22
3- import pytest
43
54from src .core .library .alchemy .fields import _FieldID
65from src .qt .widgets .tag import TagWidget
@@ -25,26 +24,19 @@ def test_tag_widget(qtbot, library, qt_driver):
2524 assert tag_widget .add_modal .isVisible ()
2625
2726
28- @pytest .mark .skip
29- def test_tag_widget_add_existing_raises (qtbot , library , qt_driver ):
27+ def test_tag_widget_add_existing_raises (library , qt_driver , entry_full ):
3028 # Given
31- entry = next (library .get_entries (with_joins = True ))
32- print (entry .tag_box_fields )
33-
34- tag_field = [f for f in entry .tag_box_fields if f .type_key == _FieldID .TAGS .name ][0 ]
35-
36- assert len (entry .tags ) == 1
37- tag = next (iter (entry .tags ))
38- tag_widget = TagBoxWidget (tag_field , "title" , qt_driver )
29+ tag_field = [
30+ f for f in entry_full .tag_box_fields if f .type_key == _FieldID .TAGS .name
31+ ][0 ]
32+ assert len (entry_full .tags ) == 1
33+ tag = next (iter (entry_full .tags ))
3934
4035 # When
41- qtbot . add_widget ( tag_widget )
42- tag_widget .driver .frame_content = [entry ]
36+ tag_widget = TagBoxWidget ( tag_field , "title" , qt_driver )
37+ tag_widget .driver .frame_content = [entry_full ]
4338 tag_widget .driver .selected = [0 ]
4439
45- entry = next (library .get_entries (with_joins = True ))
46- print (entry .tag_box_fields )
47-
4840 # Then
4941 with patch .object (tag_widget , "error_occurred" ) as mocked :
5042 tag_widget .add_modal .widget .tag_chosen .emit (tag .id )
0 commit comments