def testFunction(domain_url, session): (status, briefing, message, api_location) = findAPILocation(domain_url) if status != 0: return (status, briefing, message, None) username = "******" if delete_user_channel(session, domain_url, api_location, username): status = 0 briefing = "Could successfully delete test user channel: <strong>%s@%s</strong>" % ( username, domain_url) message = "We could successfully assert deletion of test user channel <strong>%s@%s</strong>." % ( username, domain_url) message += "<br/>That test user channel was being used for testing purposes." else: if not user_channel_exists(session, domain_url, api_location, username): status = 2 briefing = "The test user channel <strong>%s@%s</strong> was " % ( username, domain_url) briefing += "expected to exist but it didn't, so it could not be deleted again." message = briefing if (create_user_channel(session, domain_url, api_location, username) and close_this_user_channel(session, domain_url, api_location, username) and delete_user_channel(session, domain_url, api_location, username)): status = 0 additional_info = "<br/>But we could assert that <em>authorized</em> user channel deletion is being " additional_info += "properly implemented by your API server." briefing += additional_info message += additional_info message += "<br/>We created the expected test user channel and then were successful in deleting it again." else: message += "<br/>The problem is we cannot assert that <em>authorized</em> user channel deletion is working." else: status = 1 briefing = "The test user channel <strong>%s@%s</strong> could not be deleted." % ( username, domain_url) message = briefing message += "<br/>It seems like your HTTP API server is problematic. It had trouble deleting an " message += "<em>authorized</em> user channel - that operation must work." return (status, briefing, message, None)
def testFunction(domain_url, session): (status, briefing, message, api_location) = findAPILocation(domain_url) if status != 0: return (status, briefing, message, None) username = "******" if delete_user_channel(session, domain_url, api_location, username): status = 0 briefing = "Could successfully delete test user channel: <strong>%s@%s</strong>" % (username, domain_url) message = "We could successfully assert deletion of test user channel <strong>%s@%s</strong>." % (username, domain_url) message += "<br/>That test user channel was being used for testing purposes." else: if not user_channel_exists(session, domain_url, api_location, username): status = 2 briefing = "The test user channel <strong>%s@%s</strong> was " % (username, domain_url) briefing += "expected to exist but it didn't, so it could not be deleted again." message = briefing if ( create_user_channel(session, domain_url, api_location, username) and close_this_user_channel(session, domain_url, api_location, username) and delete_user_channel(session, domain_url, api_location, username) ): status = 0 additional_info = "<br/>But we could assert that <em>authorized</em> user channel deletion is being " additional_info += "properly implemented by your API server." briefing += additional_info message += additional_info message += "<br/>We created the expected test user channel and then were successful in deleting it again." else: message += "<br/>The problem is we cannot assert that <em>authorized</em> user channel deletion is working." else: status = 1 briefing = "The test user channel <strong>%s@%s</strong> could not be deleted." % (username, domain_url) message = briefing message += "<br/>It seems like your HTTP API server is problematic. It had trouble deleting an " message += "<em>authorized</em> user channel - that operation must work." return (status, briefing, message, None)
def testFunction(domain_url, session): (status, briefing, message, api_location) = findAPILocation(domain_url) if status != 0: return (status, briefing, message, None) username = "******" if create_user_channel(session, domain_url, api_location, username): if ( open_this_user_channel(session, domain_url, api_location, username) ): status = 0 briefing = "Could successfully create test user channel: <strong>%s@%s</strong>" % (username, domain_url) message = "We could successfully assert creation of test user channel <strong>%s@%s</strong>." % (username, domain_url) message += "<br/>That test user channel will be used for testing purposes." else: status = 1 briefing = "Could successfully create test user channel <strong>%s@%s</strong> " % (username, domain_url) briefing += "but could not change privacy setting to <em>open</em>!" message = "We could successfully assert creation of test user channel <strong>%s@%s</strong>." % (username, domain_url) message += "<br/>The problem is we could not have its privacy setting set to <em>open</em>." message += "<br/>That test user channel is intended to be open and will be used for testing purposes." else: if user_channel_exists(session, domain_url, api_location, username): status = 2 briefing = "The test user channel <strong>%s@%s</strong> wasn't " % (username, domain_url) briefing += "expected to exist but it did, so it could not be created again." message = briefing if ( delete_user_channel(session, domain_url, api_location, username) and create_user_channel(session, domain_url, api_location, username) ): status = 0 additional_info = "<br/>But we could assert that <em>open</em> user channel creation is being " additional_info += "properly implemented by your API server." briefing += additional_info message += additional_info message += "<br/>We deleted the existing test user channel and then were successful in creating it again." else: message += "<br/>The problem is we cannot assert that <em>open</em> user channel creation is working." else: status = 1 briefing = "The test user channel <strong>%s@%s</strong> could not be created." % (username, domain_url) message = briefing message += "<br/>It seems like your HTTP API server is problematic. It had trouble creating an " message += "<em>open</em> user channel - that operation must work." return (status, briefing, message, None)
def testFunction(domain_url, session): CLASSIFIED = { 'CREATED' : [], 'UNEXPECTED' : [], 'UNEXPECTED_BUT_WORKED' : [], 'NOT_CREATED' : [] } (status, briefing, message, api_location) = findAPILocation(domain_url) if status != 0: return (status, briefing, message, None) prefix = "test_user_channel_follower" for i in range(1, 5): username = prefix + str(i) if create_user_channel(session, domain_url, api_location, username): CLASSIFIED['CREATED'].append("%s@%s" % (username, domain_url)) else: if user_channel_exists(session, domain_url, api_location, username): if ( delete_user_channel(session, domain_url, api_location, username) and create_user_channel(session, domain_url, api_location, username) ): CLASSIFIED['UNEXPECTED_BUT_WORKED'].append("%s@%s" % (username, domain_url)) else: CLASSIFIED['UNEXPECTED'].append("%s@%s" % (username, domain_url)) else: CLASSIFIED['NOT_CREATED'].append("%s@%s" % (username, domain_url)) status = 0 briefing = "" message = "" if ( len(CLASSIFIED.get('NOT_CREATED', [])) > 0 ): status = 1 briefing = "The following test user channels could not be created:" message = briefing briefing += " <strong>%s</strong>" % string.join(CLASSIFIED['NOT_CREATED'], " | ") message += "<br/><br/><strong>%s</strong>" % string.join(CLASSIFIED['NOT_CREATED'], "<br/>") message += "<br/>It seems like your HTTP API server is problematic. It had trouble creating " message += "user channels - these operations must work." if ( len(CLASSIFIED.get('UNEXPECTED', [])) > 0 ): if status == 0: status = 2 info = "The following test user channels weren't expected to exist but they did, so they could not be created again: " if not briefing: briefing = info briefing += "<strong>%s</strong>" % string.join(CLASSIFIED['UNEXPECTED'], " | ") message = info else: message += "<br/>" + info message += "<br/><br/><strong>%s</strong>" % string.join(CLASSIFIED['UNEXPECTED'], "<br/>") message += "<br/>The problem is we cannot assert that user channel creation is working." if ( len(CLASSIFIED.get('UNEXPECTED_BUT_WORKED', [])) > 0 ): info = "The test following user channels weren't expected to exist but they did, so they could not be created again: " if not briefing: briefing = info briefing += "<strong>%s</strong>" % string.join(CLASSIFIED['UNEXPECTED_BUT_WORKED'], " | ") message = info else: message += "<br/>" + info message += "<br/><br/><strong>%s</strong>" % string.join(CLASSIFIED['UNEXPECTED_BUT_WORKED'], "<br/>") info = "<br/>But we could assert that user channel creation worked for some test user channels." briefing += info message += info message += "<br/>We deleted the existing test user channels and then were successful in creating them again." if ( len(CLASSIFIED.get('CREATED', [])) > 0 ): info = "We could successfully assert creation of the following test user channels: " info += "<br/><br/><strong>%s</strong>" % string.join(CLASSIFIED['CREATED'], "<br/>") info += "<br/>These test user channels will be used for testing purposes." if not briefing: briefing = "Could successfully create the following test user channels: " briefing += "<strong>%s</strong>" % string.join(CLASSIFIED['CREATED'], " | ") message = info else: message += "<br/>" + info return (status, briefing, message, None)
def testFunction(domain_url, session): CLASSIFIED = { 'DELETED': [], 'UNEXPECTED': [], 'UNEXPECTED_BUT_WORKED': [], 'NOT_DELETED': [] } (status, briefing, message, api_location) = findAPILocation(domain_url) if status != 0: return (status, briefing, message, None) prefix = "test_user_channel_follower" for i in range(1, 5): username = prefix + str(i) if delete_user_channel(session, domain_url, api_location, username): CLASSIFIED['DELETED'].append("%s@%s" % (username, domain_url)) else: if not user_channel_exists(session, domain_url, api_location, username): if (create_user_channel(session, domain_url, api_location, username) and delete_user_channel(session, domain_url, api_location, username)): CLASSIFIED['UNEXPECTED_BUT_WORKED'].append( "%s@%s" % (username, domain_url)) else: CLASSIFIED['UNEXPECTED'].append("%s@%s" % (username, domain_url)) else: CLASSIFIED['NOT_DELETED'].append("%s@%s" % (username, domain_url)) status = 0 briefing = "" message = "" if (len(CLASSIFIED.get('NOT_DELETED', [])) > 0): status = 1 briefing = "The following test user channels could not be deleted:" message = briefing briefing += " <strong>%s</strong>" % string.join( CLASSIFIED['NOT_DELETED'], " | ") message += "<br/><br/><strong>%s</strong>" % string.join( CLASSIFIED['NOT_DELETED'], "<br/>") message += "<br/>It seems like your HTTP API server is problematic. It had trouble deleting " message += "user channels - these operations must work." if (len(CLASSIFIED.get('UNEXPECTED', [])) > 0): if status == 0: status = 2 info = "The following test user channels were expected to exist but they didn't, so they could not be deleted again: " if not briefing: briefing = info briefing += "<strong>%s</strong>" % string.join( CLASSIFIED['UNEXPECTED'], " | ") message = info else: message += "<br/>" + info message += "<br/><br/><strong>%s</strong>" % string.join( CLASSIFIED['UNEXPECTED'], "<br/>") message += "<br/>The problem is we cannot assert that user channel deletion is working." if (len(CLASSIFIED.get('UNEXPECTED_BUT_WORKED', [])) > 0): info = "The test following user channels were expected to exist but they didn't, so they could not be deleted again: " if not briefing: briefing = info briefing += "<strong>%s</strong>" % string.join( CLASSIFIED['UNEXPECTED_BUT_WORKED'], " | ") message = info else: message += "<br/>" + info message += "<br/><br/><strong>%s</strong>" % string.join( CLASSIFIED['UNEXPECTED_BUT_WORKED'], "<br/>") info = "<br/>But we could assert that user channel deletion worked for some test user channels." briefing += info message += info message += "<br/>We created the expected test user channels and then were successful in deleting them again." if (len(CLASSIFIED.get('DELETED', [])) > 0): info = "We could successfully assert deletion of the following test user channels: " info += "<br/><br/><strong>%s</strong>" % string.join( CLASSIFIED['DELETED'], "<br/>") info += "<br/>These test user channels were being used for testing purposes." if not briefing: briefing = "Could successfully delete the following test user channels: " briefing += "<strong>%s</strong>" % string.join( CLASSIFIED['DELETED'], " | ") message = info else: message += "<br/>" + info return (status, briefing, message, None)