-
Notifications
You must be signed in to change notification settings - Fork 163
[1LP][RFR] Create test_import_tag and implement fixtures and functions it needs #10162
Changes from 6 commits
87f5a36
70716bd
a527410
c29f23f
54bb6fd
43650ff
3e390b1
bd33e8f
6e9f5f3
a3bbb5b
0438283
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 |
|---|---|---|
|
|
@@ -124,6 +124,30 @@ def test_map_tagging_crud(appliance, category, soft_assert): | |
| .format(map_tag_entity.label)) | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def csv_tag_file(create_vm, category, tag): | ||
| file_name = 'test_import_' + fauxfactory.gen_alphanumeric(4) + ".csv" | ||
|
||
| csv_data = f'name,category,entry\n{create_vm.name},{category.display_name},{tag.display_name}' | ||
|
Member
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. Shouldn't you be using a random alphanumeric for the tag, instead of trying to import a tag that matches an existing one? The
Contributor
Author
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. yes. The import is to add the existing tag value to a VM. If the tag or category or VM do not exist, the upload fails. the terms here are confusing between a category, entry, tag etc. . I believe i have the bahavior ad it is in the BZ.
Member
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. Can you add to the docblock for the test case the description that you're importing tag mappings to a VM, and not just tag definitions.
Contributor
Author
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. Done |
||
| # create CSV file | ||
| with open(file_name, "w") as file: | ||
| file.write(csv_data) | ||
| yield file | ||
| file.delete() | ||
|
|
||
|
|
||
| @test_requirements.tag | ||
| def test_import_tag(appliance, create_vm, category, tag, csv_tag_file): | ||
| """Test importing tag via file | ||
| Polarion: | ||
| assignee: prichard | ||
| initialEstimate: 1/4h | ||
| casecomponent: Tagging | ||
| Bugzilla: | ||
| 1792185 | ||
| """ | ||
| category.import_tag_from_file(csv_tag_file.name) | ||
|
||
|
|
||
|
|
||
| @test_requirements.tag | ||
| def test_updated_tag_name_on_vm(provider, tag, request): | ||
| """ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why must the file be at this location? tempfile should take care of the file location, and it shouldn't matter where the file is for the import in the UI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the comment. his is where I was seeing the framework put the file. I guess it handles this location so we don't need to care about it.