-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathbase.py
More file actions
31 lines (25 loc) · 896 Bytes
/
base.py
File metadata and controls
31 lines (25 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from unittest import TestCase
from src.superannotate import SAClient
sa = SAClient()
class BaseApplicationTestCase(TestCase):
PROJECT_NAME = ""
PROJECT_DESCRIPTION = "Desc"
PROJECT_TYPE = "Vector"
TEST_FOLDER_PATH = "data_set"
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
BaseApplicationTestCase.PROJECT_NAME = (
BaseApplicationTestCase.__class__.__name__
)
def attach_random_items(self, count=5, name_prefix="example_image_", folder=None):
path = self.PROJECT_NAME
if folder:
path = f"{self.PROJECT_NAME}/{folder}"
uploaded, _, __ = sa.attach_items(
path,
[
{"name": f"{name_prefix}{i}.jpg", "url": f"url_{i}"}
for i in range(1, count + 1)
], # noqa
)
assert len(uploaded) == count