Skip to content

Commit ef4bdc8

Browse files
author
Matt Sokoloff
committed
add test for html instructions
1 parent c893f5d commit ef4bdc8

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/integration/test_project.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22

33
import pytest
4+
import requests
45

56
from labelbox import Project, LabelingFrontend
67
from labelbox.exceptions import InvalidQueryError
@@ -97,7 +98,22 @@ def test_attach_instructions(client, project):
9798

9899
with pytest.raises(ValueError) as exc_info:
99100
project.upsert_instructions('/tmp/file.invalid_file_extension')
100-
assert "instructions_file must be a pdf. Found" in str(exc_info.value)
101+
assert "instructions_file must be a pdf or html file. Found" in str(
102+
exc_info.value)
103+
104+
105+
def test_html_instructions(configured_project):
106+
html_file_path = '/tmp/instructions.html'
107+
sample_html_str = "<html></html>"
108+
109+
with open(html_file_path, 'w') as file:
110+
file.write(sample_html_str)
111+
112+
configured_project.upsert_instructions(html_file_path)
113+
updated_ontology = configured_project.ontology().normalized
114+
115+
instructions = updated_ontology.pop('projectInstructions')
116+
assert requests.get(instructions).text == sample_html_str
101117

102118

103119
def test_same_ontology_after_instructions(

0 commit comments

Comments
 (0)