コード例 #1
0
ファイル: test_server.py プロジェクト: nictuku/nwu
    def test_add_computer(self):

        assert Local.check_token(UNIQ, TOKEN) == False

        # no servers in the database
        zero = Computer.query.count()
        assert zero == 0

        # server doesn't exist yet
        session = RPC.session_setup(UNIQ, TOKEN)
        assert session == False

        m = Computer(hostname='moinmoin', uniq=UNIQ, os_name='Linux', 
            os_version='2.6.x')
        objectstore.flush()
        log.debug("Created %s" % repr(m))
        assert Local.check_token(UNIQ, TOKEN) == True
#        assert Local.check_token(UNIQ, 'foo') == False
#        assert Local.check_token(UNIQ, TOKEN + 'oops') == False

        session = RPC.session_setup(UNIQ, TOKEN)
        assert session == [ UNIQ, TOKEN ] 
コード例 #2
0
ファイル: test_server.py プロジェクト: nictuku/nwu
    def test_install(self):
        # we need objects from the other tests    
        objectstore.flush()
        target_pkgs = ['install_a', 'install_b']
        CLI.cmd_forceinstall(1, *target_pkgs)
        assert RPC.get_tasks([UNIQ, TOKEN]) == [('forceinstall', 
            'install_a install_b')]
        assert CLI.cmd_list() == '1\tmoinmoin\tLinux\n'
        assert CLI.cmd_view(1, 'packages') == \
'Reading packages from computer <Computer moinmoin(1)>' 
        m = Computer.get_by(id=1)
        installed = CurrentPackages(computer=m, name='gcc', version='1.1')
        installed = CurrentPackages(computer=m, name='znes', version='4.1')
        objectstore.flush()
        # this just a dumb debug. 
        # FIXME: use a proper __repr__ on the CurrPackages class
        log.debug(CLI.cmd_view(1, 'packages'))