예제 #1
0
	def test_export(self):
		FILENAME = 'conf/users.conf'
		self.assertFalse(os.path.exists(FILENAME))
		Users.export()
		self.assertTrue(os.path.exists(FILENAME))
예제 #2
0
	def test_first_user(self):
		first_user = Users.first()
		self.assertEqual(first_user.id, _DEFAULT_USER)
		self.assertEqual(first_user.password, _DEFAULT_PASSWORD)
		Users.users = {}
		self.assertIsNone(Users.first())
예제 #3
0
	def test_auth_negative(self):
		self.assertEqual(Users.auth(_DEFAULT_USER, 'wrong_pwd', _DEFAULT_HOST), None)
		self.assertEqual(Users.auth('wrong_user', _DEFAULT_PASSWORD, _DEFAULT_HOST), None)
예제 #4
0
	def test_user_get_switch_host(self):
		user = Users.User()
		new_switch_host = 'local'
		user.setSwitchHost(new_switch_host)
		self.assertEqual(user.getSwitchHost(), new_switch_host)
예제 #5
0
	def test_user_get_require_auth(self):
		user = Users.User()
		self.assertIs(user.getRequireAuth(), 'True', 'All users require Auth by default')
		user.setRequireAuth(False)
		self.assertIs(user.getRequireAuth(), 'False')
예제 #6
0
파일: server.py 프로젝트: zhentan/nut
def initThread(app):
	nut.scan()
	app.refresh()
	if Config.autolaunchBrowser:
		webbrowser.open_new_tab('http://' + urllib.parse.quote_plus(Users.first().id) + ':' + urllib.parse.quote_plus(Users.first().password) + '@' + getIpAddress() + ':' + str(Config.server.port))
예제 #7
0
 def test_save(self):  # pylint: disable = no-self-use
     Users.save()
예제 #8
0
 def test_user_load_csv_with_empty_map(self):
     user = Users.User()
     user.loadCsv("id|pwd")
     self.assertIsNone(user.id)
     self.assertIsNone(user.password)
예제 #9
0
 def test_user_serialize(self):
     user = Users.first()
     serialized = user.serialize()
     self.assertEqual(serialized, "guest|guest")
예제 #10
0
	def getValue(self):
		user = Users.User()
		user.id = self.user.getValue()
		user.password = self.password.getValue()
		return user