Example #1
0
class GenericProfileTest(EntityTentdTestCase):    
    def before(self):
        super(GenericProfileTest, self).before()
        
        self.profile = GenericProfile(
            entity=self.entity,
            schema="https://tent.io/types/info/example/v0.0.0",
            content={
                'attr': 'value',
                'dict': {'attr': 'value'},
                'list': [1, 2, 3],
            })
        self.profile.save()

    def test_attributes(self):
        assert self.profile.content['dict']['attr'] == 'value'

    def test_json_attributes(self):
        profile = Profile.objects.get(id=self.profile.id)
        assert profile.to_json()['content']['dict']['attr'] == 'value'

    def test_unique_schema(self):
        with self.assertRaises(NotUniqueError):
            GenericProfile(
                entity=self.entity,
                schema="https://tent.io/types/info/example/v0.0.0").save()
Example #2
0
class GenericProfileTest(EntityTentdTestCase):
    def before(self):
        super(GenericProfileTest, self).before()

        self.profile = GenericProfile(
            entity=self.entity,
            schema="https://tent.io/types/info/example/v0.0.0",
            content={
                'attr': 'value',
                'dict': {
                    'attr': 'value'
                },
                'list': [1, 2, 3],
            })
        self.profile.save()

    def test_attributes(self):
        assert self.profile.content['dict']['attr'] == 'value'

    def test_json_attributes(self):
        profile = Profile.objects.get(id=self.profile.id)
        assert profile.to_json()['content']['dict']['attr'] == 'value'

    def test_unique_schema(self):
        with self.assertRaises(NotUniqueError):
            GenericProfile(
                entity=self.entity,
                schema="https://tent.io/types/info/example/v0.0.0").save()
Example #3
0
    def before(self):
        super(GenericProfileTest, self).before()

        self.profile = GenericProfile(
            entity=self.entity,
            schema="https://tent.io/types/info/example/v0.0.0",
            content={
                'attr': 'value',
                'dict': {
                    'attr': 'value'
                },
                'list': [1, 2, 3],
            })
        self.profile.save()
Example #4
0
 def before(self):
     super(GenericProfileTest, self).before()
     
     self.profile = GenericProfile(
         entity=self.entity,
         schema="https://tent.io/types/info/example/v0.0.0",
         content={
             'attr': 'value',
             'dict': {'attr': 'value'},
             'list': [1, 2, 3],
         })
     self.profile.save()
Example #5
0
 def test_unique_schema(self):
     with self.assertRaises(NotUniqueError):
         GenericProfile(
             entity=self.entity,
             schema="https://tent.io/types/info/example/v0.0.0").save()