Exemplo n.º 1
0
    def test_register_and_find(self):
        '''
        Test that License classes can be registered with id
        '''
        class FooLicense(base.License):
            id = 'FOO'

        license.register(FooLicense)
        assert license.find('FOO') == FooLicense
Exemplo n.º 2
0
    def test_register_no_id(self):
        '''
        Test that License classes cannot be registered without id
        '''
        class FooLicense(base.License):
            pass

        with pytest.raises(AttributeError):
            license.register(FooLicense)
Exemplo n.º 3
0
    def test_register_and_find(self):
        '''
        Test that License classes can be registered with id
        '''
        class FooLicense(base.License):
            id = 'FOO'

        license.register(FooLicense)
        assert license.find('FOO') == FooLicense
Exemplo n.º 4
0
    def test_register_no_id(self):
        '''
        Test that License classes cannot be registered without id
        '''
        class FooLicense(base.License):
            pass

        with pytest.raises(AttributeError):
            license.register(FooLicense)
Exemplo n.º 5
0
 def test_register_find_custom_license(self):
     '''
     Test that custom license can be registered and found
     '''
     try:
         license.register(self.custom_cls)
         assert license.find('CUSTOM') == self.custom_cls
     finally:
         # unregister, just in case
         try:
             del license.core._db['CUSTOM']
         except:
             pass
Exemplo n.º 6
0
 def test_register_find_custom_license(self):
     '''
     Test that custom license can be registered and found
     '''
     try:
         license.register(self.custom_cls)
         assert license.find('CUSTOM') == self.custom_cls
     finally:
         # unregister, just in case
         try:
             del license.core._db['CUSTOM']
         except:
             pass