Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EvaMart committed Oct 24, 2024
1 parent e125e48 commit 8e41281
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 39 deletions.
4 changes: 2 additions & 2 deletions app/tests/test_compA1_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from app.models.instance import Instance

def test_compA1_1_with_operational_true():
instance = Instance(type='rest', webpage=["https://github.com/inab/oeb-visualizations"], operational=True)
instance = Instance(type='rest', webpage=["https://github.com"], operational=True)
result, logs = compA1_1(instance)
print(logs)
assert result == True
Expand All @@ -20,7 +20,7 @@ def test_compA1_1_with_webpage_empty():
assert result == False

def test_compA1_1_with_no_web_type():
instance = Instance(type='cmd', webpage=["https://github.com/inab/oeb-visualizations"], operational=True)
instance = Instance(type='cmd', webpage=["https://github.com"], operational=True)
result, logs = compA1_1(instance)
print(logs)
assert result == False
Expand Down
4 changes: 2 additions & 2 deletions app/tests/test_compA1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from app.models.instance import Instance

def test_compA1_2_with_no_web_and_download():
instance = Instance(type='cmd', download=["https://github.com/inab/oeb-visualizations"], source=[])
instance = Instance(type='cmd', download=["https://github.com"], source=[])
result, logs = compA1_2(instance)
assert result == True

Expand All @@ -24,7 +24,7 @@ def test_compA1_2_with_cmd_and_empty_download_and_source():
assert result == False

def test_compA1_2_with_web_and_valid_download():
instance = Instance(type='web', download=["https://github.com/inab/oeb-visualizations"], source=[])
instance = Instance(type='web', download=["https://github.com"], source=[])
result, logs = compA1_2(instance)
assert result == False

Expand Down
8 changes: 4 additions & 4 deletions app/tests/test_compA1_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def create_instance(type, download, source, documentation):
def test_compA1_3_with_no_web_and_download():
instance = create_instance(
type='cmd',
download=["https://github.com/inab/oeb-visualizations"],
download=["https://github.com"],
source=[],
documentation=[]
)
Expand All @@ -38,7 +38,7 @@ def test_compA1_3_with_no_web_and_installation_instructions():
type='cmd',
download=[],
source=[],
documentation=[{'type': 'installation instructions', 'url': 'https://github.com/inab/oeb-visualizations'}]
documentation=[{'type': 'installation instructions', 'url': 'https://github.com'}]
)
result, logs = compA1_3(instance)
print(logs)
Expand Down Expand Up @@ -68,7 +68,7 @@ def test_compA1_3_with_no_web_and_empty_download_source_and_documentation():
def test_compA1_3_with_web_and_valid_download():
instance = create_instance(
type='web',
download=["http://github.com/inab/oeb-visualizations"],
download=["https://github.com"],
source=[],
documentation=[]
)
Expand All @@ -90,7 +90,7 @@ def test_compA1_3_with_web_and_installation_instructions():
type='web',
download=[],
source=[],
documentation=[{'type': 'installation', 'url': 'http://github.com/inab/oeb-visualizations'}]
documentation=[{'type': 'installation', 'url': 'https://github.com'}]
)
result, logs = compA1_3(instance)
assert result == False
Expand Down
8 changes: 4 additions & 4 deletions app/tests/test_compA1_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#
def test_compA1_4_with_test_data():
instance = Instance(test=['https://github.com/inab/oeb-visualizations'], documentation=[])
instance = Instance(test=['https://github.com'], documentation=[])
result, logs = compA1_4(instance)
assert result == True

Expand All @@ -15,18 +15,18 @@ def test_compA1_4_with_no_test_data():
assert result == False

def test_compA1_4_with_test_data_in_docs():
instance = Instance(test=[], documentation=[{'type': 'test data', 'url': 'https://github.com/inab/oeb-visualizations'}])
instance = Instance(test=[], documentation=[{'type': 'test data', 'url': 'https://github.com'}])
result, logs = compA1_4(instance)
print(logs)
assert result == True

def test_compA1_4_with_no_test_data_in_docs():
instance = Instance(test=[], documentation=[{'type': 'other', 'url': 'https://github.com/inab/oeb-visualizations'}])
instance = Instance(test=[], documentation=[{'type': 'other', 'url': 'https://github.com'}])
result, logs = compA1_4(instance)
assert result == False

def test_compA1_4_with_mixed_test_data():
instance = Instance(test=['https://github.com/inab/oeb-visualizations'], documentation=[{'type': 'test data', 'url': 'https://github.com/inab/oeb-visualizations'}])
instance = Instance(test=['https://github.com'], documentation=[{'type': 'test data', 'url': 'https://github.com'}])
result, logs = compA1_4(instance)
assert result == True

Expand Down
4 changes: 2 additions & 2 deletions app/tests/test_compA1_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from app.models.instance import Instance

def test_compA1_5_with_no_web_and_source_code():
instance = Instance(type='cmd', src=["https://github.com/inab/oeb-visualizations"])
instance = Instance(type='cmd', src=["https://github.com"])
result, logs = compA1_5(instance)
assert result == True

Expand All @@ -14,7 +14,7 @@ def test_compA1_5_with_no_web_and_no_source_code():
assert result == False

def test_compA1_5_with_web_and_source_code():
instance = Instance(type='web', src=["https://github.com/inab/oeb-visualizations"])
instance = Instance(type='web', src=["https://github.com"])
result, logs = compA1_5(instance)
assert result == False

Expand Down
6 changes: 3 additions & 3 deletions app/tests/test_compF3_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def __init__(self, repository):
self.repository = repository

def test_compF3_2_with_valid_repositories():
instance = MockInstance(repository=["https://github.com/inab/oeb-visualizations", "https://bitbucket.org/user/repo"])
instance = MockInstance(repository=["https://github.com", "https://bitbucket.org/user/repo"])
result, logs = compF3_2(instance)
assert result == True

Expand All @@ -23,7 +23,7 @@ def test_compF3_2_with_none_repositories():
assert result == False

def test_compF3_2_with_single_valid_repository():
instance = MockInstance(repository=["https://github.com/inab/oeb-visualizations"])
instance = MockInstance(repository=["https://github.com"])
result, logs = compF3_2(instance)
assert result == True

Expand All @@ -33,7 +33,7 @@ def test_compF3_2_with_invalid_repositories():
assert result == False

def test_compF3_2_with_mixed_repositories():
instance = MockInstance(repository=["https://github.com/inab/oeb-visualizations", ""])
instance = MockInstance(repository=["https://github.com", ""])
result, logs = compF3_2(instance)
assert result == True

Expand Down
8 changes: 4 additions & 4 deletions app/tests/test_compI1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
from app.services.i_indicators import compI1_2

def test_compI1_2_with_api_specification():
docs=[Documentation(type="API specification", url="https://inab.github.io/oeb-visualizations/")]
docs=[Documentation(type="API specification", url="https://github.com")]
instance = Instance(documentation=docs, type='rest')
result, logs = compI1_2(instance)
assert result == True

def test_compI1_2_with_multiple_documentations_including_api_specification():
docs=[
Documentation(type="General documentation", url="https://inab.github.io/oeb-visualizations/"),
Documentation(type="API specification", url="https://inab.github.io/oeb-visualizations/")
Documentation(type="General documentation", url="https://github.com"),
Documentation(type="API specification", url="https://github.com")
]
instance = Instance(documentation=docs, type='rest')
result, logs = compI1_2(instance)
assert result == True

def test_compI1_2_with_no_api_specification():
docs=[Documentation(type="General documentation", url="https://inab.github.io/oeb-visualizations/")]
docs=[Documentation(type="General documentation", url="https://github.com")]
instance = Instance(documentation=docs)
result, logs = compI1_2(instance)
assert result == False
Expand Down
10 changes: 5 additions & 5 deletions app/tests/test_compR1_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

# Test cases
def test_compR1_1_with_usage_guide():
instance = Instance(documentation=[Documentation(type='usage guide', url='https://inab.github.io/oeb-visualizations/')])
instance = Instance(documentation=[Documentation(type='usage guide', url='https://github.com')])
result, logs = compR1_1(instance)
assert result == True

def test_compR1_1_with_usage_guide_no_op_url():
instance = Instance(documentation=[Documentation(type='usage guide', url='https://github.io/oeb-visualizations/')])
instance = Instance(documentation=[Documentation(type='usage guide', url='https://github.com')])
result, logs = compR1_1(instance)
assert result == False

Expand All @@ -22,8 +22,8 @@ def test_compR1_1_with_license():

def test_compR1_1_with_mixed_docs():
instance = Instance(documentation=[
Documentation(type='license', url='https://inab.github.io/oeb-visualizations/'),
Documentation(type='usage guide', url='https://inab.github.io/oeb-visualizations/')
Documentation(type='license', url='https://github.com'),
Documentation(type='usage guide', url='https://github.com')
])
result, logs = compR1_1(instance)
assert result == True
Expand All @@ -47,7 +47,7 @@ def test_compR1_1_with_none_docs():
assert result == False

def test_compR1_1_with_case_insensitive_check():
instance = Instance(documentation=[Documentation(type='UsAgE GuIdE', url='https://inab.github.io/oeb-visualizations/')])
instance = Instance(documentation=[Documentation(type='UsAgE GuIdE', url='https://github.com')])
result, logs = compR1_1(instance)
assert result == True

Expand Down
6 changes: 3 additions & 3 deletions app/tests/test_compR2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# Test cases
def test_compR2_1_with_valid_documentation():
instance = Instance(
documentation=[Documentation(type='License', url='https://inab.github.io/oeb-visualizations/')],
documentation=[Documentation(type='License', url='https://github.com')],
license=[]
)
result, logs = compR2_1(instance)
Expand Down Expand Up @@ -45,7 +45,7 @@ def test_compR2_1_with_no_license_and_no_relevant_documentation():

def test_compR2_1_with_valid_documentation_and_invalid_license():
instance = Instance(
documentation=[Documentation(type='Terms of Service', url='https://inab.github.io/oeb-visualizations/')],
documentation=[Documentation(type='Terms of Service', url='https://github.com')],
license=[License(name='Unlicensed', url='https://example.com')]
)
result, logs = compR2_1(instance)
Expand All @@ -70,7 +70,7 @@ def test_compR2_1_with_partial_license_name():

def test_compR2_1_with_documentation_variation():
instance = Instance(
documentation=[Documentation(type='End User License Agreement', url='https://inab.github.io/oeb-visualizations/')],
documentation=[Documentation(type='End User License Agreement', url='https://github.com')],
license=[]
)
result, logs = compR2_1(instance)
Expand Down
12 changes: 6 additions & 6 deletions app/tests/test_compR3_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@
# Test cases for compR3_1 function
def test_compR3_1_with_valid_policy_types():
for policy in VALID_CONTRIBUTION_POLICIES:
instance = Instance(documentation=[Documentation(type=policy, url='https://inab.github.io/oeb-visualizations/')])
instance = Instance(documentation=[Documentation(type=policy, url='https://github.com')])
result, logs = compR3_1(instance)
assert result == True

def test_compR3_1_with_invalid_policy_types():
for policy in INVALID_CONTRIBUTION_POLICIES:
instance = Instance(documentation=[Documentation(type=policy, url='https://inab.github.io/oeb-visualizations/')])
instance = Instance(documentation=[Documentation(type=policy, url='https://github.com')])
result, logs = compR3_1(instance)
assert result == False

def test_compR3_1_with_mixed_policy_types():
mixed_documentation = [
Documentation(type='contribution policy',url='https://inab.github.io/oeb-visualizations/'),
Documentation(type='technical document',url='https://inab.github.io/oeb-visualizations/'),
Documentation(type='contributing guidelines',url='https://inab.github.io/oeb-visualizations/')
Documentation(type='contribution policy',url='https://github.com'),
Documentation(type='technical document',url='https://github.com'),
Documentation(type='contributing guidelines',url='https://github.com')
]
instance = Instance(documentation=mixed_documentation)
result, logs = compR3_1(instance)
Expand All @@ -61,6 +61,6 @@ def test_compR3_1_with_case_insensitive_check():
'contribution RULES'
]
for policy in case_insensitive_policies:
instance = Instance(documentation=[Documentation(type=policy, url='https://inab.github.io/oeb-visualizations/')])
instance = Instance(documentation=[Documentation(type=policy, url='https://github.com')])
result, logs = compR3_1(instance)
assert result == True
8 changes: 4 additions & 4 deletions app/tests/test_compR4_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
# Test cases for compR4_2 function
def test_compR4_2_with_release_policy():
# Case where a document type matches 'release policy'
docs = [Documentation(type='release policy', url='https://inab.github.io/oeb-visualizations/')]
docs = [Documentation(type='release policy', url='https://github.com')]
instance = Instance(documentation=docs)
result, logs = compR4_2(instance)
assert result == True

def test_compR4_2_with_version_release_policy():
# Case where a document type matches 'version release policy'
docs = [Documentation(type='version release policy', url='https://inab.github.io/oeb-visualizations/')]
docs = [Documentation(type='version release policy', url='https://github.com')]
instance = Instance(documentation=docs)
result, logs = compR4_2(instance)
assert result == True

def test_compR4_2_with_distribution_policy():
# Case where a document type matches 'distribution policy'
docs = [Documentation(type='distribution policy', url='https://inab.github.io/oeb-visualizations/')]
docs = [Documentation(type='distribution policy', url='https://github.com')]
instance = Instance(documentation=docs)
result, logs = compR4_2(instance)
assert result == True
Expand All @@ -34,7 +34,7 @@ def test_compR4_2_with_mixed_document_types():
# Case where some document types match and others do not
docs = [
Documentation(type='usage guide'),
Documentation(type='release policy', url='https://inab.github.io/oeb-visualizations/')
Documentation(type='release policy', url='https://github.com')
]
instance = Instance(documentation=docs)
result, logs = compR4_2(instance)
Expand Down

0 comments on commit 8e41281

Please sign in to comment.