Пример #1
0
	def test_first_start_config_file_filled(self):
		mmailer.main()
		citems = self.get_default_config_scheme()
		config = SafeConfigParser()
		config.read(self.config_path)
		assert config.has_section('Mail')
		assert config.items('Mail') == citems
Пример #2
0
	def test_2nd_start_dont_overwrite_config(self):
		try:
			mmailer.main()
		except:
			pass
		mod_time = os.path.getmtime(self.config_path)
		try:
			mmailer.main()
		except:
			pass
		mod_time2 = os.path.getmtime(self.config_path)
		assert mod_time == mod_time2
Пример #3
0
	def test_command_edit_table(self):
		proj_dir = self.mm_create_project('Test')
		self.create_with_sample_files("", proj_dir)
		env['EDITOR'] = 'gedit'
		sys.argv = ['mmailer', 'edit-table']
		subprocess_call_save = subprocess.call
		subprocess.call = self.save_call
		abs_file = os.path.join(proj_dir, 'keys.csv')
		assert mmailer.main(sys.argv) == 0
		subprocess.call = subprocess_call_save
		assert os.path.exists(abs_file), os.path.join(proj_dir, 'keys.txt')
		assert self.last_call == ['gedit', abs_file], self.last_call
		import filecmp
		target = os.path.join('tests','samples', 'keys-empty.csv')
		assert filecmp.cmp(target, abs_file)
Пример #4
0
	def test_command_edit(self):
		proj_dir = self.mm_create_project('Test')
		env['EDITOR'] = 'gedit'
		sys.argv = ['mmailer', 'edit']
		subprocess_call_save = subprocess.call
		subprocess.call = self.save_call
		assert mmailer.main(sys.argv) == 0
		subprocess.call = subprocess_call_save
		files = ['mail.txt', 'subject.txt', 'attachments.txt']
		abs_files = []
		for f in files:
			abs_file = os.path.join(proj_dir, f)
			#assert os.path.isfile(abs_file)
			abs_files.append(abs_file)
		assert self.last_call == ['gedit', abs_files[0], \
			abs_files[1], abs_files[2]], self.last_call
Пример #5
0
	def test_first_start_config_file_created(self):
		mmailer.main()
		assert os.path.isfile(self.config_path)