<s> """<STR_LIT>""" <EOL> import bz2file <EOL> import gzip <EOL> import unittest <EOL> from mock import patch <EOL> from vulyk . cli import admin , db <EOL> from . base import ( <EOL> _collection , <EOL> BaseTest , <EOL> mocked_get_connection , <EOL> ) <EOL> class TestAdmin ( BaseTest ) : <EOL> def setUp ( self ) : <EOL> super ( TestAdmin , self ) . setUp ( ) <EOL> self . user_collection = _collection . user <EOL> self . group_collection = _collection . groups <EOL> self . users = [ <EOL> dict ( username = '<STR_LIT:1>' , email = '<STR_LIT>' , admin = True ) , <EOL> dict ( username = '<STR_LIT:2>' , email = '<STR_LIT>' , admin = True ) , <EOL> dict ( username = '<STR_LIT:3>' , email = '<STR_LIT>' , admin = False ) , <EOL> ] <EOL> for obj in self . users : <EOL> obj [ '<STR_LIT>' ] = self . user_collection . insert ( obj ) <EOL> self . groups = [ <EOL> dict ( description = '<STR_LIT:test>' , _id = '<STR_LIT:default>' , allowed_types = [ '<STR_LIT:test>' ] ) <EOL> ] <EOL> for obj in self . groups : <EOL> obj [ '<STR_LIT>' ] = self . group_collection . insert ( obj ) <EOL> @ patch ( '<STR_LIT>' , mocked_get_connection ) <EOL> def test_toggle_admin ( self ) : <EOL> admin . toggle_admin ( '<STR_LIT>' , False ) <EOL> admin . toggle_admin ( '<STR_LIT>' , True ) <EOL> admin . toggle_admin ( '<STR_LIT>' , True ) <EOL> self . assertFalse ( <EOL> self . user_collection . find_one ( { '<STR_LIT:email>' : '<STR_LIT>' } ) [ '<STR_LIT>' ] <EOL> ) <EOL> self . assertTrue ( <EOL> self . user_collection . find_one ( { '<STR_LIT:email>' : '<STR_LIT>' } ) [ '<STR_LIT>' ] <EOL> ) <EOL> self . assertTrue ( <EOL> self . user_collection . find_one ( { '<STR_LIT:email>' : '<STR_LIT>' } ) [ '<STR_LIT>' ] <EOL> ) <EOL> class TestDB ( BaseTest ) : <EOL> def setUp ( self ) : <EOL> super ( TestDB , self ) . setUp ( ) <EOL> def test_open_anything ( self ) : <EOL> filename = '<STR_LIT>' <EOL> self . assertEqual ( db . open_anything ( filename ) , bz2file . BZ2File ) <EOL> filename = '<STR_LIT>' <EOL> self . assertEqual ( db . open_anything ( filename ) , gzip . open ) <EOL> def test_load_tasks ( self ) : <EOL> pass <EOL> def test_export_tasks ( self ) : <EOL> pass <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
