Skip to content

Commit f201d82

Browse files
author
Glenn Snyder
committed
removing irrelevant snippet unit tests
1 parent 0808077 commit f201d82

File tree

1 file changed

+0
-80
lines changed

1 file changed

+0
-80
lines changed

test/test_hub_rest_api_python.py

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -397,90 +397,10 @@ def test_create_version_reports(requests_mock, mock_hub_instance):
397397
def test_create_version_notices_report(requests_mock, mock_hub_instance):
398398
pass
399399

400-
@pytest.fixture()
401-
def unreviewed_snippet_json(shared_datadir):
402-
with (shared_datadir / "unreviewed_snippet.json").open() as f:
403-
yield json.load(f)[0]
404-
405-
def test_get_ignore_snippet_json(unreviewed_snippet_json, mock_hub_instance):
406-
assert 'fileSnippetBomComponents' in unreviewed_snippet_json
407-
assert unreviewed_snippet_json['fileSnippetBomComponents'][0]['ignored'] == False
408-
409-
result = mock_hub_instance.get_ignore_snippet_json(unreviewed_snippet_json)
410-
411-
assert isinstance(result, list)
412-
assert len(result) == 1
413-
assert 'fileSnippetBomComponents' in result[0]
414-
assert 'ignored' in result[0]['fileSnippetBomComponents'][0]
415-
assert 'reviewStatus' in result[0]['fileSnippetBomComponents'][0]
416-
assert result[0]['fileSnippetBomComponents'][0]['ignored'] == True
417-
assert result[0]['fileSnippetBomComponents'][0]['reviewStatus'] == 'NOT_REVIEWED'
418-
419-
def test_get_confirm_snippet_json(unreviewed_snippet_json, mock_hub_instance):
420-
assert 'fileSnippetBomComponents' in unreviewed_snippet_json
421-
assert unreviewed_snippet_json['fileSnippetBomComponents'][0]['ignored'] == False
422-
423-
result = mock_hub_instance.get_confirm_snippet_json(unreviewed_snippet_json)
424-
425-
assert isinstance(result, list)
426-
assert len(result) == 1
427-
assert 'fileSnippetBomComponents' in result[0]
428-
assert 'ignored' in result[0]['fileSnippetBomComponents'][0]
429-
assert 'reviewStatus' in result[0]['fileSnippetBomComponents'][0]
430-
assert result[0]['fileSnippetBomComponents'][0]['ignored'] == False
431-
assert result[0]['fileSnippetBomComponents'][0]['reviewStatus'] == 'REVIEWED'
432-
433-
434-
@pytest.fixture()
435-
def sample_snippet_match_json(shared_datadir):
436-
yield json.load((shared_datadir / "sample-snippet-match.json").open())
437-
438-
439-
def test_generate_new_match_selection(sample_snippet_match_json, mock_hub_instance):
440-
assert 'fileSnippetBomComponents' in sample_snippet_match_json
441-
assert len(sample_snippet_match_json['fileSnippetBomComponents']) == 1
442-
443-
# Copy the snippet component match data and delete the keys that are normally missing
444-
# from a (vanilla) snippet component alternate match
445-
new_component = copy.deepcopy(sample_snippet_match_json['fileSnippetBomComponents'][0])
446-
del new_component['ignored']
447-
del new_component['reviewStatus']
448-
del new_component['versionBomComponentId']
449-
new_component['release']['version'] = 'different-version'
450-
451-
# now verify that they are restored when we prepare to select/update using the alternate match
452-
update_body = mock_hub_instance._generate_new_match_selection(sample_snippet_match_json, new_component)
453-
454-
assert len(update_body) == 1
455-
assert 'fileSnippetBomComponents' in update_body[0]
456-
assert len(update_body[0]['fileSnippetBomComponents']) == 1
457-
updated_component_info = update_body[0]['fileSnippetBomComponents'][0]
458-
original_component_info = sample_snippet_match_json['fileSnippetBomComponents'][0]
459-
for k in ['ignored', 'reviewStatus', 'versionBomComponentId']:
460-
assert k in updated_component_info
461-
assert updated_component_info[k] == original_component_info[k]
462-
463400
@pytest.fixture()
464401
def sample_bom_component_json(shared_datadir):
465402
yield json.load((shared_datadir / "sample-bom-component.json").open())
466403

467-
def test_get_edit_snippet_json(sample_snippet_match_json, sample_bom_component_json, mock_hub_instance):
468-
assert 'component' in sample_bom_component_json
469-
assert 'componentVersion' in sample_bom_component_json
470-
assert 'fileSnippetBomComponents' in sample_snippet_match_json
471-
assert len(sample_snippet_match_json['fileSnippetBomComponents']) == 1
472-
473-
new_component_id = sample_bom_component_json['component'].split("/")[-1]
474-
new_component_version_id = sample_bom_component_json['componentVersion'].split("/")[-1]
475-
476-
new_snippet_bom_entry_l = mock_hub_instance.get_edit_snippet_json(sample_snippet_match_json, sample_bom_component_json)
477-
478-
assert len(new_snippet_bom_entry_l) == 1
479-
new_snippet_bom_entry = new_snippet_bom_entry_l[0]
480-
481-
assert new_component_id == new_snippet_bom_entry['fileSnippetBomComponents'][0]['project']['id']
482-
assert new_component_version_id == new_snippet_bom_entry['fileSnippetBomComponents'][0]['release']['id']
483-
484404
@pytest.fixture()
485405
def no_roles_user(shared_datadir):
486406
yield json.load((shared_datadir / 'no-roles-user.json').open())

0 commit comments

Comments
 (0)