Exemplo n.º 1
0
    def setUp(self):
        super().setUp()

        term_type_1 = TermType.objects.create(
            name=str(uuid4()),
            description='Random term type',
            is_categorical=True,
            metadata_schema=simple_JSON_schema(),
            synonym_metadata_schema=simple_JSON_schema())
        term_type_2 = TermType.objects.create(
            name=str(uuid4()),
            description='Random term type',
            is_categorical=True,
            metadata_schema=simple_JSON_schema(),
            synonym_metadata_schema=simple_JSON_schema())

        EntailmentType.objects.create(source_type=term_type_1,
                                      target_type=term_type_2,
                                      metadata_schema=simple_JSON_schema())

        self.type_1_terms = [
            Term.objects.create(term_type=term_type_1,
                                value=str(uuid4()),
                                description='Random term',
                                metadata={}) for _ in range(40)
        ]

        self.type_2_terms = [
            Term.objects.create(term_type=term_type_2,
                                value=str(uuid4()),
                                description='Random term',
                                metadata={}) for _ in range(40)
        ]
Exemplo n.º 2
0
 def generate_random_json_data():
     data = {
         'name': str(uuid4()),
         'description': 'Random term type',
         'is_categorical': True,
         'metadata_schema': simple_JSON_schema(),
         'synonym_metadata_schema': simple_JSON_schema(),
     }
     return data
Exemplo n.º 3
0
 def generate_random_json_data(self):
     data = {
         'device_type': self.device_type.pk,
         'brand': self.brand.pk,
         'model': str(uuid4()),
         'metadata_schema': simple_JSON_schema(),
         'configuration_schema': simple_JSON_schema(),
     }
     return data
 def setUp(self):
     super(TermSuggestionTestCase, self).setUp()
     self.random_user = User.objects.create(username=str(uuid4()),
                                            password=str(uuid4()))
     self.term_type = TermType.objects.create(
         name=str(uuid4()),
         description='Random term type',
         is_categorical=True,
         metadata_schema=simple_JSON_schema(),
         synonym_metadata_schema=simple_JSON_schema())
Exemplo n.º 5
0
    def setUp(self):
        super(EventTypeTestCase, self).setUp()

        self.event_type = self.create_random_object()
        self.term_type = TermType.objects.create(
            name=str(uuid4()),
            description='random term type',
            is_categorical=True,
            metadata_schema=simple_JSON_schema(),
            synonym_metadata_schema=simple_JSON_schema())
Exemplo n.º 6
0
 def setUp(self):
     super(SynonymTestCase, self).setUp()
     term_type = TermType.objects.create(
         name=str(uuid4()),
         description='random term type',
         is_categorical=True,
         metadata_schema=simple_JSON_schema(),
         synonym_metadata_schema=simple_JSON_schema())
     self.terms = [
         Term.objects.create(term_type=term_type, value=str(uuid4()))
         for _ in range(40)
     ]
Exemplo n.º 7
0
 def generate_random_json_data():
     data = {
         'name': str(uuid4()),
         'description': 'Random site type',
         'metadata_schema': simple_JSON_schema()
     }
     return data
Exemplo n.º 8
0
    def setUp(self):
        super(PhysicalDevicesTestCase, self).setUp()
        self.random_user = User.objects.create(username=str(uuid4()),
                                               password=str(uuid4()))

        device_type = DeviceType.objects.create(
            name=str(uuid4()), description='Random device type')

        device_brand = DeviceBrand.objects.create(name=str(uuid4()))

        self.device = Device.objects.create(
            device_type=device_type,
            brand=device_brand,
            model=str(uuid4()),
            metadata_schema=simple_JSON_schema(),
            configuration_schema=simple_JSON_schema())
 def generate_random_json_data():
     data = {
         'name': str(uuid4()),
         'description': 'Random Annotation Tool',
         'annotation_schema': simple_JSON_schema()
     }
     return data
Exemplo n.º 10
0
 def generate_random_json_data():
     data = {
         'name': str(uuid4()),
         'version': randint(1, 10),
         'description': 'Random Annotation Tool',
         'configuration_schema': simple_JSON_schema()
     }
     return data
Exemplo n.º 11
0
    def add_role(self, role, metadata_schema=None):
        if metadata_schema is None:
            metadata_schema = simple_JSON_schema()

        CollectionRole.objects.get_or_create(collection_type=self,
                                             role=role,
                                             metadata_schema=metadata_schema)
        self.save()
Exemplo n.º 12
0
    def add_device_type(self, device_type, metadata_schema=None):
        if metadata_schema is None:
            metadata_schema = simple_JSON_schema()

        CollectionDeviceType.objects.get_or_create(
            collection_type=self,
            device_type=device_type,
            metadata_schema=metadata_schema)
        self.save()
 def generate_random_json_data():
     source_type, target_type = sample(
         EntailmentTypeTestCase.term_type_names, 2)
     data = {
         'source_type': source_type,
         'target_type': target_type,
         'metadata_schema': simple_JSON_schema()
     }
     return data
Exemplo n.º 14
0
    def setUp(self):
        super(SiteTestCase, self).setUp()

        self.random_user = User.objects.create(username=str(uuid4()),
                                               password=str(uuid4()))
        self.site_type = SiteType.objects.create(
            name=str(uuid4()),
            description='Random Site Type',
            metadata_schema=simple_JSON_schema())
Exemplo n.º 15
0
    def add_item_type(self, item_type, metadata_schema=None):
        if metadata_schema is None:
            metadata_schema = simple_JSON_schema()

        CollectionItemType.objects.get_or_create(
            collection_type=self,
            item_type=item_type,
            metadata_schema=metadata_schema)
        self.save()
Exemplo n.º 16
0
 def generate_random_json_data():
     data = {
         'name': str(uuid4()),
         'description': 'Random sampling event type',
         'metadata_schema': simple_JSON_schema(),
         'restrict_device_types': False,
         'restrict_site_types': False
     }
     return data
Exemplo n.º 17
0
 def generate_random_json_data():
     data = {
         'name': str(uuid4()),
         'description': 'Random licence type',
         'metadata_schema': simple_JSON_schema(),
         'years_valid_for': 3,
         'document_template': None,
         'can_view': False,
         'can_download': False,
         'can_view_annotations': False,
         'can_annotate': False,
         'can_vote_annotations': False,
     }
     return data