Last active
March 31, 2020 20:43
-
-
Save dasmido/68b25fc052a73771d6ac3c86a7d26492 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################################################################## | |
# Tester : Mohammed Jamal Hadi # | |
# Program : Republic of Testers # | |
# Submission date : 01-APRIL-2019 SATURDAY 16:00 # | |
# License : Educational Purpose, ELTE IK, Spring 2019 # | |
# # | |
# Declaration : This Solution was submitted and prepared by # | |
# Mohammed Jamal Hadi , neptun-TBRUEJ # | |
# for the Republic of Testers assignment # | |
# of the Software and Quality testing course spring 2019. # | |
# # | |
# Example # | |
# How to test the program # | |
# $ python3 rot_test.py # | |
# Input: 1980-09-05, M, 49, 18009054331492 # | |
# # | |
######################################################################## | |
import unittest | |
from rot import * | |
print(str(result)) | |
class Test_luhn(unittest.TestCase): | |
#################################################################### | |
# Test with Input: 1980-09-05, M, 49, 18009054331492 | |
#################################################################### | |
def test_luhn_first(self): | |
self.assertTrue(is_luhn_valid(18009054331492), True) | |
def test_luhn_second(self): | |
self.assertFalse(is_luhn_valid(1800905433149), False) | |
@unittest.expectedFailure | |
def test_list_int(self): | |
self.assertEqual(str(is_luhn_valid(1800905433149)), 'True') | |
def test_dob(self): | |
self.assertEqual(str(dob), '1980-09-05') | |
@unittest.expectedFailure | |
def test_dob_fail(self): | |
self.assertRaises(dob, '09-1980-05') | |
# test with right data | |
def test_gender(self): | |
self.assertEqual(str(gender), ' M') | |
@unittest.expectedFailure | |
def test_gender_fail(self): | |
self.assertEqual(str(gender), 'M') | |
def test_place(self): | |
self.assertEqual(str(place), ' 49') | |
@unittest.expectedFailure | |
def test_place_fail(self): | |
self.assertRaises(str(place), '49') | |
########################################################################## | |
# Trick Test | |
# Checksum is valid but born code not valid | |
# | |
# Test with Input: 2010-09-05, F, 52, 21009055020495 | |
# | |
########################################################################## | |
# when Born place code is Valid and checksum is valid | |
def test_trick_data(self): | |
self.assertEqual(idd[11] == '0' and idd[12:14] == place[1:3], True) | |
# when Born Place Code is NOT VALID and checksum is Valid | |
# Test with Input: 2010-09-05, F, 52, 21009055020495 | |
@unittest.expectedFailure | |
def test_trick_data_fail(self): | |
self.assertEqual(idd[11] == '0' and idd[12:14] == place[1:3], True) | |
# test with 1980-09-05, M, 52, 18009054331526 should fail | |
@unittest.expectedFailure | |
def test_trick_data_fail(self): | |
self.assertEqual(idd[12:14] == '52' and idd[11] != '0', False) | |
# check the condition if true pass the test | |
def test_trick_data_fail(self): | |
self.assertEqual(idd[12:14] == '52' and idd[11] != '0', True) | |
############################################################################ | |
# Test with Input: 2010-09-05, F, 52, 21009055020529 | |
############################################################################ | |
def test_luhn_first(self): | |
self.assertTrue(is_luhn_valid(21009055020529), True) | |
def test_luhn_second(self): | |
self.assertFalse(is_luhn_valid(21009055020), False) | |
@unittest.expectedFailure | |
def test_list_int(self): | |
self.assertEqual(str(is_luhn_valid(21009055020)), 'True') | |
def test_dob(self): | |
self.assertEqual(str(dob), '1980-09-05') | |
@unittest.expectedFailure | |
def test_dob_fail(self): | |
self.assertRaises(dob, '09-1980-05') | |
@unittest.expectedFailure | |
def test_female_gender(self): | |
self.assertEqual(str(gender), ' F') | |
@unittest.expectedFailure | |
def test_female_gender_fail(self): | |
self.assertEqual(str(gender), 'F') | |
def test_place(self): | |
self.assertEqual(str(place), ' 52') | |
@unittest.expectedFailure | |
def test_place_fail(self): | |
self.assertRaises(str(place), '52') | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment