Ejemplo n.º 1
0
	def test_no_config(self):
		clusters = {
			"cluster1": {
				"cluster_id": 1
			},
			"cluster2": {
				"cluster_id": 2
			},
		}

		a = StaticAuthenticator(clusters)
		self.assertFalse(a.is_configured())
Ejemplo n.º 2
0
	def test_with_config_list(self):
		clusters = {
			"cluster1": {
				"cluster_id": 1,
				"user": [ "user1", "user3" ]
			},
			"cluster2": {
				"cluster_id": 2,
				"user": "******"
			},
		}

		a = StaticAuthenticator(clusters, getpwnam=mock_getpwnam)
		self.assertTrue(a.is_configured())

		self.assertTrue(a.is_allowed("cluster1", 0, 1, 1))
		self.assertFalse(a.is_allowed("cluster1", 0, 2, 1))
		self.assertTrue(a.is_allowed("cluster1", 0, 3, 1))