def setUp(self): self.allCertificates = AllCertificates() self.allCertificates.getAllCertificates().append( Certificate('Ranjith', 'Tharayil', '*****@*****.**')) self.allCertificates.getAllCertificates().append( Certificate('R', 'Tharayil', '*****@*****.**')) self.allCertificates.getAllCertificates().append( Certificate('anjith', 'Tharayil', '*****@*****.**'))
def test_AddingCertificates(self): self.allCertificates.getAllCertificates().clear() self.allCertificates.getAllCertificates().append( Certificate('Ranjith', 'Tharayil', '*****@*****.**')) self.allCertificates.getAllCertificates().append( Certificate('Ranjith', 'Tharayil', '*****@*****.**')) self.allCertificates.getAllCertificates().append( Certificate('Ranjith', 'Tharayil', '*****@*****.**')) self.assertEqual(3, len(self.allCertificates.getAllCertificates()))
def load(self, certificates, inputFileName, email): with open(inputFileName, 'r') as file: reader = csv.reader(file, delimiter=',') for row in reader: if email == True: certificates.append( Certificate(row[1].strip(), row[2].strip(), row[3].strip())) else: certificates.append( Certificate(row[1].strip(), row[2].strip(), 'NoEmail')) certificates.pop(0)
def test_getACertificatesEmail(self): self.allCertificates.getAllCertificates().clear() self.allCertificates.getAllCertificates().append( Certificate('Ranjith', ' Tharayil', '*****@*****.**')) for c in self.allCertificates.getAllCertificates(): self.assertEqual('*****@*****.**', c.Email())
def test_genMDFile(self): pathToSave = './md' if os.path.isdir(pathToSave): shutil.rmtree(pathToSave) os.mkdir(pathToSave) certificate = Certificate('Rahul', 'Panday', '*****@*****.**') mdFile = self.mdGen.Create(pathToSave, 'https://certifyme.online/devopsma/', certificate) self.assertTrue(os.path.exists(mdFile))
def test_Create(self): pathToSave = './temp' if os.path.isdir(pathToSave): shutil.rmtree(pathToSave) os.mkdir(pathToSave) certificate = Certificate('Rahul', 'Panday', '*****@*****.**') certificateFile = self.issue.Create( './test/data/template.png', pathToSave, 'https://certifyme.online/devopsma/', certificate) self.assertTrue(os.path.exists(pathToSave + '/' + certificateFile))