def setup_function(function): # setup mock requestors global requestors requestors = [] # account without special chars mockRequestorInstance1 = MockRequestor() mockRequestorInstance1.setAccount('testaccount1') mockRequestorInstance1.printers = [] requestors.append(mockRequestorInstance1) Auth.config = '/tmp/cloudprint.conf'
def setup_function(function): # setup mock requestors global requestors requestors = [] # account without special chars mockRequestorInstance1 = MockRequestor() mockRequestorInstance1.setAccount('testaccount1') mockRequestorInstance1.printers = [] requestors.append(mockRequestorInstance1) # with @ symbol mockRequestorInstance2 = MockRequestor() mockRequestorInstance2.setAccount('*****@*****.**') mockRequestorInstance2.printers = [ { 'name' : 'Save to Google Drive', 'id' : '__google__docs', 'capabilities' : [{ 'name' : 'ns1:Colors', 'type' : 'Feature' }] }, ] requestors.append(mockRequestorInstance2) # 1 letter mockRequestorInstance3 = MockRequestor() mockRequestorInstance3.setAccount('t') mockRequestorInstance3.printers = [] requestors.append(mockRequestorInstance3) # instantiate printer item if function != test_instantiate: test_instantiate()
def test_invalidRequest ( ) : testMock = MockRequestor() assert testMock.doRequest('thisrequestisinvalid') == None