def test_output_file_contents(self):
     values = ["Priyanka", "33", "Mumbai"]
     sys.stdin = InputStub(values)
     write_user_details.accept_and_write()
     fp = open("Priyanka.txt")
     name = fp.readline()
     age = fp.readline()
     city = fp.readline()
     self.assertEqual(name[0 : len(name) - 1], "Name : Priyanka")
     self.assertEqual(age[0 : len(age) - 1], "Age : 33")
     self.assertEqual(city[0 : len(city) - 1], "City : Mumbai")
 def test_output_file_contents(self):
     values = ['Priyanka', '33', 'Mumbai']
     sys.stdin = InputStub(values)
     write_user_details.accept_and_write()
     fp = open('Priyanka.txt')
     name = fp.readline()
     age = fp.readline()        
     city = fp.readline()
     self.assertEqual(name[0:len(name)-1], 'Name : Priyanka')
     self.assertEqual(age[0:len(age)-1], 'Age : 33')
     self.assertEqual(city[0:len(city)-1], 'City : Mumbai')
 def test_output_file_contents(self):
     values = ['Priyanka', '33', 'Mumbai']
     output_stub = OutputStub()
     write_user_details.open = gen_open_stub(output_stub)
     sys.stdin = InputStub(values)
     write_user_details.accept_and_write()
     name = output_stub.values[0]
     age = output_stub.values[1]
     city = output_stub.values[2]
     self.assertEqual(name[0:len(name)-1], 'Name : Priyanka')
     self.assertEqual(age[0:len(age)-1], 'Age : 33')
     self.assertEqual(city[0:len(city)-1], 'City : Mumbai')
Example #4
0
 def test_output_file_contents(self):
     values = ['Priyanka', '33', 'Mumbai']
     output_stub = OutputStub()
     write_user_details.open = gen_open_stub(output_stub)
     sys.stdin = InputStub(values)
     write_user_details.accept_and_write()
     name = output_stub.values[0]
     age = output_stub.values[1]
     city = output_stub.values[2]
     self.assertEqual(name[0:len(name) - 1], 'Name : Priyanka')
     self.assertEqual(age[0:len(age) - 1], 'Age : 33')
     self.assertEqual(city[0:len(city) - 1], 'City : Mumbai')