Beispiel #1
0
 def test_validate_for_jinja_removes_licenses_if_invalid_type(self):
     self.descriptor['licenses'] = 1
     descriptor = logic.validate_for_template(self.descriptor)
     self.assertEqual(descriptor.get('licenses'), None)
Beispiel #2
0
 def test_validate_for_not_errors_if_licenses_is_dict_and_has_no_type_key(
         self):
     self.descriptor['licenses'] = {'url': 'test/url'}
     descriptor = logic.validate_for_template(self.descriptor)
     self.assertEqual(descriptor['license'], None)
Beispiel #3
0
 def test_validate_for_jinja_returns_descriptor_if_licenses_is_list(self):
     self.descriptor['licenses'] = []
     descriptor = logic.validate_for_template(self.descriptor)
     self.assertEqual(self.descriptor, descriptor)
Beispiel #4
0
 def test_validate_for_jinja_modifies_descriptor_if_licenses_is_dict(self):
     self.descriptor['licenses'] = {'url': 'test/url', 'type': 'Test'}
     descriptor = logic.validate_for_template(self.descriptor)
     self.assertEqual(descriptor['license'], 'Test')
Beispiel #5
0
 def test_validate_for_jinja_returns_descriptor_if_no_licenses(self):
     descriptor = logic.validate_for_template(self.descriptor)
     self.assertEqual(self.descriptor, descriptor)