Example #1
0
    def test_remove_token(self):
        tokens.add_token('test')
        result = tokens.remove_token('test')
        assert result is True

        result = tokens.remove_token('test2')
        assert result is False
Example #2
0
    def test_add(self):
        result = tokens.add_token('whatAffects')
        assert isinstance(result, tokens.Token) is True

        result = tokens.add_token('category',
                                  natural='natural',
                                  practical='practical',
                                  dramatic='dramatic',
                                  volumetric='volumetric',
                                  default='natural')
        assert isinstance(result, tokens.Token) is True
Example #3
0
 def setup(self):
     tokens.reset_tokens()
     tokens.add_token('whatAffects')
     tokens.add_token_number('digits')
     tokens.add_token('category',
                      natural='natural',
                      practical='practical',
                      dramatic='dramatic',
                      volumetric='volumetric',
                      default='natural')
     tokens.add_token('function',
                      key='key',
                      fill='fill',
                      ambient='ambient',
                      bounce='bounce',
                      rim='rim',
                      custom='custom',
                      kick='kick',
                      default='custom')
     tokens.add_token('type',
                      lighting='LGT',
                      animation='ANI',
                      default='lighting')
     rules.reset_rules()
     rules.add_rule('lights',
                    '{category}_{function}_{whatAffects}_{digits}_{type}')
Example #4
0
 def setup(self):
     tokens.reset_tokens()
     rules.reset_rules()
     tokens.add_token('side',
                      center='C',
                      left='L',
                      right='R',
                      default='center')
     tokens.add_token('region',
                      orbital="ORBI",
                      parotidmasseter="PAROT",
                      mental="MENT",
                      frontal="FRONT",
                      zygomatic="ZYGO",
                      retromandibularfossa="RETMAND")
     rules.add_rule("filename",
                    '{side}-{region}_{side}-{region}_{side}-{region}')
Example #5
0
 def setup(self):
     tokens.reset_tokens()
     self.light_category = tokens.add_token('category',
                                            natural='natural',
                                            practical='practical',
                                            dramatic='dramatic',
                                            volumetric='volumetric',
                                            default='natural')
Example #6
0
    def test_save_load_token(self):
        tokens.add_token('test',
                         key='key',
                         fill='fill',
                         ambient='ambient',
                         bounce='bounce',
                         rim='rim',
                         custom='custom',
                         kick='kick',
                         default='custom')
        tempdir = tempfile.mkdtemp()
        tokens.save_token('test', tempdir)

        tokens.reset_tokens()
        file_name = "{}.token".format('test')
        filepath = os.path.join(tempdir, file_name)
        tokens.load_token(filepath)
        assert tokens.has_token('test') is True
Example #7
0
 def test_tokens(self):
     token1 = tokens.add_token('function',
                               key='key',
                               fill='fill',
                               ambient='ambient',
                               bounce='bounce',
                               rim='rim',
                               custom='custom',
                               kick='kick',
                               default='custom')
     token2 = tokens.Token.from_data(token1.data())
     assert token1.data() == token2.data()
Example #8
0
    def test_validation(self):
        token = tokens.add_token('function',
                                 key='key',
                                 fill='fill',
                                 ambient='ambient',
                                 bounce='bounce',
                                 rim='rim',
                                 custom='custom',
                                 kick='kick',
                                 default='custom')
        rule = rules.add_rule(
            'lights', '{category}_{function}_{whatAffects}_{digits}_{type}')
        tokens.add_token_number('digits')

        assert rules.Rule.from_data(token.data()) is None
        assert tokens.Token.from_data(rule.data()) is None
Example #9
0
    def test_save_load_session(self):
        tokens.add_token('whatAffects')
        tokens.add_token_number('digits')
        tokens.add_token('category',
                         natural='natural',
                         practical='practical',
                         dramatic='dramatic',
                         volumetric='volumetric',
                         default='natural')
        tokens.add_token('function',
                         key='key',
                         fill='fill',
                         ambient='ambient',
                         bounce='bounce',
                         rim='rim',
                         custom='custom',
                         kick='kick',
                         default='custom')
        tokens.add_token('type',
                         lighting='LGT',
                         animation='ANI',
                         default='lighting')
        rules.add_rule('lights',
                       '{category}.{function}.{whatAffects}.{digits}.{type}')
        rules.add_rule('test', '{category}_{function}')
        rules.set_active_rule('lights')

        repo = tempfile.mkdtemp()
        save_result = n.save_session(repo)
        assert save_result is True

        rules.reset_rules()
        tokens.reset_tokens()

        n.load_session(repo)
        assert tokens.has_token('whatAffects') is True
        assert tokens.has_token('digits') is True
        assert tokens.has_token('category') is True
        assert tokens.has_token('function') is True
        assert tokens.has_token('type') is True
        assert rules.has_rule('lights') is True
        assert rules.has_rule('test') is True
        assert rules.get_active_rule().name == 'lights'
Example #10
0
 def setup(self):
     tokens.reset_tokens()
     tokens.add_token('awesometoken')