示例#1
0
	def test_save_cred(self):
		"""
		test_save_cred to check if the initialized object is saved to credentials_info
		"""
		self.new_cred = Credentials("komo","james","IG","pswd001")
		self.new_cred.save_cred()
		self.assertEqual(len(Credentials.credentials_info),5)
    def test_setUp(self):
        """
		test_setUp to create a new Credentials object to begin tests
		"""

        self.new_cred = Credentials("Simon", "SPG", "Instagram",
                                    "W3w3n!mkenya")
    def test_save_cred(self):
        """
		test_save_cred to check if the initialized object is saved to credentials_info
		"""
        self.new_cred = Credentials("Simon", "SPG", "Instagram",
                                    "W3w3n!mkenya")
        self.new_cred.save_cred()
        self.assertEqual(len(Credentials.credentials_info), 3)
示例#4
0
	def test_show_credentials(self):
		"""
		test_show_credentials test to check if credentials saved is displayed
		"""
		self.new_cred = Credentials("komo","james","IG","pswd001")
		self.new_cred.save_cred()
		self.another_cred = Credentials("komo","james","IG","pswd001")
		self.another_cred.save_cred()
		self.assertEqual(len(Credentials.show_credentials(self.new_cred.username)),1)
示例#5
0
	def test_init(self):
		"""
		test_init to check if the Credentials objects are initialized correctly
		"""
		self.new_cred = Credentials("komo","james","IG","pswd001")
		self.assertEqual(self.new_cred.name, "komo")
		self.assertEqual(self.new_cred.username, "james")
		self.assertEqual(self.new_cred.platform, "IG")
		self.assertEqual(self.new_cred.pwd, "pswd001")
    def test_init(self):
        """
		test_init to check if the Credentials objects are initialized correctly
		"""
        self.new_cred = Credentials("Simon", "SPG", "Instagram",
                                    "W3w3n!mkenya")
        self.assertEqual(self.new_cred.name, "Simon")
        self.assertEqual(self.new_cred.username, "SPG")
        self.assertEqual(self.new_cred.platform, "Instagram")
        self.assertEqual(self.new_cred.pwd, "W3w3n!mkenya")
    def test_show_credentials(self):
        """
		test_show_credentials test to check if credentials saved is displayed
		"""
        self.new_cred = Credentials("Simon", "SPG", "Instagram",
                                    "W3w3n!mkenya")
        self.new_cred.save_cred()
        self.another_cred = Credentials("Simon", "SPG", "Gmail",
                                        "W3w3n!mkenya")
        self.another_cred.save_cred()
        self.assertEqual(
            len(Credentials.show_credentials(self.new_cred.username)), 1)
示例#8
0
	def test_del_cred(self):
		"""
		test_del_cred test to delete credentials from the credentials list
		"""
		Credentials.credentials_info = []
		self.new_cred = Credentials("komo","james","IG","pswd001")
		self.new_cred.save_cred()
		IG = Credentials("komo","james","IG","pswd001")
		IG.save_cred()
		del_item = Credentials.find_platform('IG')
		self.assertEqual(Credentials.del_cred(del_item),"Deleted")
示例#9
0
    def test_del_cred(self):
        """
		test_del_cred test to delete credentials from the credentials list
		"""
        Credentials.credentials_info = []
        self.new_cred = Credentials("billo", "diallo", "BD", "pswd001")
        self.new_cred.save_cred()
        BD = Credentials("billo", "diallo", "BD", "pswd001")
        BD.save_cred()
        del_item = Credentials.find_platform('IG')
        self.assertEqual(Credentials.del_cred(del_item), "Deleted")
示例#10
0
    def test_del_cred(self):
        """
		test_del_cred test to delete credentials from the credentials list
		"""
        Credentials.credentials_info = []
        self.new_cred = Credentials("Simon", "SPG", "Instagram",
                                    "W3w3n!mkenya")
        self.new_cred.save_cred()
        snapchat = Credentials("Simon", "SPG", "Snapchat", "W3w3n!mkenya")
        snapchat.save_cred()
        del_item = Credentials.find_platform('Snapchat')
        self.assertEqual(Credentials.del_cred(del_item), "Deleted")
示例#11
0
	def test_find_platform(self):
		"""
		test_find_platform test to search credentials per account
		"""
		self.new_cred = Credentials("komo","james","IG","pswd001")
		self.new_cred.save_cred()
		IG = Credentials("komo","james","IG","pswd001")
		IG.save_cred()
		self.assertEqual(Credentials.find_platform('IG'),IG)
示例#12
0
    def test_find_platform(self):
        """
		test_find_platform test to search credentials per account
		"""
        self.new_cred = Credentials("billo", "diallo", "BD", "pswd001")
        self.new_cred.save_cred()
        BD = Credentials("billo", "diallo", "BD", "pswd001")
        BD.save_cred()
        self.assertEqual(Credentials.find_platform('BD'), BD)
示例#13
0
    def test_find_platform(self):
        """
		test_find_platform test to search credentials per platform
		"""
        self.new_cred = Credentials("Simon", "SPG", "Instagram",
                                    "W3w3n!mkenya")
        self.new_cred.save_cred()
        snapchat = Credentials("Simon", "SPG", "Snapchat", "W3w3n!mkenya")
        snapchat.save_cred()
        self.assertEqual(Credentials.find_platform('Snapchat'), snapchat)
示例#14
0
    def test_auth_check(self):
        """
		test_auth_check test case to test if the user provided correct information
		"""
        self.new_user = Users("Simon", "Gatheru", "W3w3n!mkenya")
        self.new_user.create_user()
        another_user = Users("Twende", "Kazi", "mkenya")
        another_user.create_user()

        for cred in Users.user_info:
            if cred.first == another_user.first and cred.password == another_user.password:
                identity = another_user.first
        return identity

        self.assertEqual(
            identity,
            Credentials.user_check(another_user.first, another_user.password))
示例#15
0
class TestCredentials(unittest.TestCase):
	"""
		Test class that defines test cases for the Credentials behaviour
	
		Args:
			unittest.TestCase: Class from the unittest module to create unit tests
	"""

	def test_auth_check(self):
		"""
		test_auth_check test case to test if the user provided correct information
		"""
		self.new_user = Users("komo","James","pswd002")
		self.new_user.create_user()
		another_user = Users("user2","othername","pswd003")
		another_user.create_user()
		
		for cred in Users.user_info:
			if cred.first == another_user.first and cred.password == another_user.password:
				identity = another_user.first
		return identity
		
	def test_setUp(self):
		"""
		test_setUp to create a new Credentials object to begin tests
		"""
		
		self.new_cred = Credentials("komo","james","IG","pswd001")
	
	def test_init(self):
		"""
		test_init to check if the Credentials objects are initialized correctly
		"""
		self.new_cred = Credentials("komo","james","IG","pswd001")
		self.assertEqual(self.new_cred.name, "komo")
		self.assertEqual(self.new_cred.username, "james")
		self.assertEqual(self.new_cred.platform, "IG")
		self.assertEqual(self.new_cred.pwd, "pswd001")
		
	def test_save_cred(self):
		"""
		test_save_cred to check if the initialized object is saved to credentials_info
		"""
		self.new_cred = Credentials("komo","james","IG","pswd001")
		self.new_cred.save_cred()
		self.assertEqual(len(Credentials.credentials_info),5)
		
	def tearDowm(self):
		"""
		reinitializes the credentials_info list to its empty state
		"""
		Credentials.credentials_info = []
		
	def test_show_credentials(self):
		"""
		test_show_credentials test to check if credentials saved is displayed
		"""
		self.new_cred = Credentials("komo","james","IG","pswd001")
		self.new_cred.save_cred()
		self.another_cred = Credentials("komo","james","IG","pswd001")
		self.another_cred.save_cred()
		self.assertEqual(len(Credentials.show_credentials(self.new_cred.username)),1)
	
	def test_find_platform(self):
		"""
		test_find_platform test to search credentials per account
		"""
		self.new_cred = Credentials("komo","james","IG","pswd001")
		self.new_cred.save_cred()
		IG = Credentials("komo","james","IG","pswd001")
		IG.save_cred()
		self.assertEqual(Credentials.find_platform('IG'),IG)
		
	def test_del_cred(self):
		"""
		test_del_cred test to delete credentials from the credentials list
		"""
		Credentials.credentials_info = []
		self.new_cred = Credentials("komo","james","IG","pswd001")
		self.new_cred.save_cred()
		IG = Credentials("komo","james","IG","pswd001")
		IG.save_cred()
		del_item = Credentials.find_platform('IG')
		self.assertEqual(Credentials.del_cred(del_item),"Deleted")
示例#16
0
    def test_setUp(self):
        """
		test_setUp to create a new Credentials object to begin tests
		"""

        self.new_cred = Credentials("billo", "diallo", "BD", "pswd001")
示例#17
0
def user_check(first,pwd):
	'''
	Does an authorization check prior to creating any credentials
	'''
	return Credentials.user_check(first,pwd)
示例#18
0
def show_cred(username):
    '''
	Displays saved credentials
	'''
    return Credentials.show_credentials(username)
示例#19
0
class TestCredentials(unittest.TestCase):
    """
		Test class that defines test cases for the Credentials behaviour
	
		Args:
			unittest.TestCase: Class from the unittest module to create unit tests
	"""
    def test_auth_check(self):
        """
		test_auth_check test case to test if the user provided correct information
		"""
        self.new_user = Users("Simon", "Gatheru", "W3w3n!mkenya")
        self.new_user.create_user()
        another_user = Users("Twende", "Kazi", "mkenya")
        another_user.create_user()

        for cred in Users.user_info:
            if cred.first == another_user.first and cred.password == another_user.password:
                identity = another_user.first
        return identity

        self.assertEqual(
            identity,
            Credentials.user_check(another_user.first, another_user.password))

    def test_setUp(self):
        """
		test_setUp to create a new Credentials object to begin tests
		"""

        self.new_cred = Credentials("Simon", "SPG", "Instagram",
                                    "W3w3n!mkenya")

    def test_init(self):
        """
		test_init to check if the Credentials objects are initialized correctly
		"""
        self.new_cred = Credentials("Simon", "SPG", "Instagram",
                                    "W3w3n!mkenya")
        self.assertEqual(self.new_cred.name, "Simon")
        self.assertEqual(self.new_cred.username, "SPG")
        self.assertEqual(self.new_cred.platform, "Instagram")
        self.assertEqual(self.new_cred.pwd, "W3w3n!mkenya")

    def test_save_cred(self):
        """
		test_save_cred to check if the initialized object is saved to credentials_info
		"""
        self.new_cred = Credentials("Simon", "SPG", "Instagram",
                                    "W3w3n!mkenya")
        self.new_cred.save_cred()
        self.assertEqual(len(Credentials.credentials_info), 3)

    def tearDowm(self):
        """
		reinitializes the credentials_info list to its empty state
		"""
        Credentials.credentials_info = []

    def test_show_credentials(self):
        """
		test_show_credentials test to check if credentials saved is displayed
		"""
        self.new_cred = Credentials("Simon", "SPG", "Instagram",
                                    "W3w3n!mkenya")
        self.new_cred.save_cred()
        self.another_cred = Credentials("Simon", "SPG", "Gmail",
                                        "W3w3n!mkenya")
        self.another_cred.save_cred()
        self.assertEqual(
            len(Credentials.show_credentials(self.new_cred.username)), 1)

    def test_find_platform(self):
        """
		test_find_platform test to search credentials per platform
		"""
        self.new_cred = Credentials("Simon", "SPG", "Instagram",
                                    "W3w3n!mkenya")
        self.new_cred.save_cred()
        snapchat = Credentials("Simon", "SPG", "Snapchat", "W3w3n!mkenya")
        snapchat.save_cred()
        self.assertEqual(Credentials.find_platform('Snapchat'), snapchat)

    def test_del_cred(self):
        """
		test_del_cred test to delete credentials from the credentials list
		"""
        Credentials.credentials_info = []
        self.new_cred = Credentials("Simon", "SPG", "Instagram",
                                    "W3w3n!mkenya")
        self.new_cred.save_cred()
        snapchat = Credentials("Simon", "SPG", "Snapchat", "W3w3n!mkenya")
        snapchat.save_cred()
        del_item = Credentials.find_platform('Snapchat')
        self.assertEqual(Credentials.del_cred(del_item), "Deleted")
示例#20
0
	def test_setUp(self):
		"""
		test_setUp to create a new Credentials object to begin tests
		"""
		
		self.new_cred = Credentials("komo","james","IG","pswd001")
示例#21
0
def password_gen(size):
	'''
	Generates a random password_gen
	'''
	random = Credentials.password_gen(size)
	return random
示例#22
0
def create_cred(name,username,platform,pwd):
	'''
	Creates credentials to be saved
	'''
	create_instance = Credentials(name,username,platform,pwd)
	return create_instance
示例#23
0
def show_cred(username):
	'''
	Shows credentials saved
	'''
	return Credentials.show_credentials(username)
示例#24
0
def user_check(first, pwd):
    '''
	Checks whether user exists before creating any new credentials
	'''
    return Credentials.user_check(first, pwd)
示例#25
0
def save_cred(cred):
	'''
	Saves created credentials
	'''
	Credentials.save_cred(cred)