def test_project_withClients(self) :
		s = Server("fixture")
		s.createServer()
		s.createProject("myproject")
		s.createClient("myproject","myclient")
		s.setClientMetadata("myproject", "myclient",
			description = "a description",
			briefDescription = "brief description",
			)
		s.createClient("myproject","yourclient")
		s.setClientMetadata("myproject", "yourclient",
			description = "your description",
			briefDescription = "your brief description",
			)

		# force an idle time
		s.now=datetime.datetime(2013,4,5,6,7,8)
		s.clientIdle("myproject", "myclient", 0)
		s.clientIdle("myproject", "yourclient", 0)

		s.now = datetime.datetime(2013,9,1,2,3,4)

		w = JsonSummary()
		result = w.project(s, 'myproject')
		self.assertMultiLineEqual(result,
			'{'
			'	"project" : "myproject",\n'
			'	"lastupdate" : "2013/09/01 02:03:04",\n'
			'	"clients" : [\n'
			'		{\n'
			'			"name": "myclient",\n'
			'			"description": \'a description\',\n'
			'			"name_details": \'brief description\',\n'
			'			"status": "int",\n'
			'			"doing": "old",\n'
			'			"lastupdate": "2013/04/05 06:07:08",\n'
			'			"lastExecution": "19000101-000000",\n'
			'		},\n'
			'		{\n'
			'			"name": "yourclient",\n'
			'			"description": \'your description\',\n'
			'			"name_details": \'your brief description\',\n'
			'			"status": "int",\n'
			'			"doing": "old",\n'
			'			"lastupdate": "2013/04/05 06:07:08",\n'
			'			"lastExecution": "19000101-000000",\n'
			'		},\n'
			'	]\n'
			'}'
			)
示例#2
0
	def test_project_withClients(self) :
		s = Logger("fixture")
		s.createServer()
		s.createProject("myproject")
		s.createClient("myproject","myclient")
		s.setClientMetadata("myproject", "myclient",
			description = "a description",
			briefDescription = "brief description",
			)
		s.createClient("myproject","yourclient")
		s.setClientMetadata("myproject", "yourclient",
			description = "your description",
			briefDescription = "your brief description",
			)

		# force an idle time
		s.now=datetime.datetime(2013,4,5,6,7,8)
		s.clientIdle("myproject", "myclient", 0)
		s.clientIdle("myproject", "yourclient", 0)

		s.now = datetime.datetime(2013,9,1,2,3,4)

		w = JsonSummary()
		result = w.project(s, 'myproject')
		self.assertMultiLineEqual(result,
			'{'
			'	"project" : "myproject",\n'
			'	"lastupdate" : "2013/09/01 02:03:04",\n'
			'	"clients" : [\n'
			'		{\n'
			'			"name": "myclient",\n'
			'			"description": \'a description\',\n'
			'			"name_details": \'brief description\',\n'
			'			"status": "int",\n'
			'			"doing": "old",\n'
			'			"lastupdate": "2013/04/05 06:07:08",\n'
			'			"lastExecution": "19000101-000000",\n'
			'		},\n'
			'		{\n'
			'			"name": "yourclient",\n'
			'			"description": \'your description\',\n'
			'			"name_details": \'your brief description\',\n'
			'			"status": "int",\n'
			'			"doing": "old",\n'
			'			"lastupdate": "2013/04/05 06:07:08",\n'
			'			"lastExecution": "19000101-000000",\n'
			'		},\n'
			'	]\n'
			'}'
			)
	def test_client_noExecutions(self) :

		s = self.setUpEmptyClient()

		w = JsonSummary()
		result = w.client(s, 'myproject', 'myclient')
		self.assertMultiLineEqual(result,
			'		{\n'
			'			"name": "myclient",\n'
			'			"description": \'a description\',\n'
			'			"name_details": \'brief description\',\n'
			'			"status": "int",\n'
			'			"doing": "old",\n'
			'			"lastupdate": "2013/04/05 06:07:08",\n'
			'			"lastExecution": "19000101-000000",\n'
			'		},\n'
			)
示例#4
0
	def test_client_noExecutions(self) :

		s = self.setUpEmptyClient()

		w = JsonSummary()
		result = w.client(s, 'myproject', 'myclient')
		self.assertMultiLineEqual(result,
			'		{\n'
			'			"name": "myclient",\n'
			'			"description": \'a description\',\n'
			'			"name_details": \'brief description\',\n'
			'			"status": "int",\n'
			'			"doing": "old",\n'
			'			"lastupdate": "2013/04/05 06:07:08",\n'
			'			"lastExecution": "19000101-000000",\n'
			'		},\n'
			)
	def test_client_greenWhileRunning(self) :
		s = self.setUpEmptyClient()
		self.setUpExecution(s, "20130405-060708")
		self.setUpExecution(s, "20130506-070809", running=True, ok=False)
		w = JsonSummary()
		result = w.client(s, 'myproject', 'myclient')
		self.assertMultiLineEqual(result,
			'		{\n'
			'			"name": "myclient",\n'
			'			"description": \'a description\',\n'
			'			"name_details": \'brief description\',\n'
			'			"status": "green",\n'
			'			"doing": "run",\n'
			'			"lastupdate": "2013/04/05 06:07:08",\n'
			'			"lastExecution": "20130405-060708",\n'
			'			"currentTask": "First task",\n'
			'		},\n'
			)
	def test_client_green(self) :

		s = self.setUpEmptyClient()
		self.setUpExecution(s, "20130506-070809")

		w = JsonSummary()
		result = w.client(s, 'myproject', 'myclient')
		self.assertMultiLineEqual(result,
			'		{\n'
			'			"name": "myclient",\n'
			'			"description": \'a description\',\n'
			'			"name_details": \'brief description\',\n'
			'			"status": "green",\n'
			'			"doing": "wait",\n'
			'			"lastupdate": "2013/04/05 06:07:08",\n'
			'			"lastExecution": "20130506-070809",\n'
			'		},\n'
			)
示例#7
0
	def test_client_green(self) :

		s = self.setUpEmptyClient()
		self.setUpExecution(s, "20130506-070809")

		w = JsonSummary()
		result = w.client(s, 'myproject', 'myclient')
		self.assertMultiLineEqual(result,
			'		{\n'
			'			"name": "myclient",\n'
			'			"description": \'a description\',\n'
			'			"name_details": \'brief description\',\n'
			'			"status": "green",\n'
			'			"doing": "wait",\n'
			'			"lastupdate": "2013/04/05 06:07:08",\n'
			'			"lastExecution": "20130506-070809",\n'
			'		},\n'
			)
示例#8
0
	def test_client_greenWhileRunning(self) :
		s = self.setUpEmptyClient()
		self.setUpExecution(s, "20130405-060708")
		self.setUpExecution(s, "20130506-070809", running=True, ok=False)
		w = JsonSummary()
		result = w.client(s, 'myproject', 'myclient')
		self.assertMultiLineEqual(result,
			'		{\n'
			'			"name": "myclient",\n'
			'			"description": \'a description\',\n'
			'			"name_details": \'brief description\',\n'
			'			"status": "green",\n'
			'			"doing": "run",\n'
			'			"lastupdate": "2013/04/05 06:07:08",\n'
			'			"lastExecution": "20130405-060708",\n'
			'			"currentTask": "First task",\n'
			'			"currentExecution": "20130506-070809",\n'
			'		},\n'
			)
	def test_project_noClients(self) :
		s = Server("fixture")
		s.createServer()
		s.createProject("myproject")
		s.setProjectMetadata("myproject",
			description = "project description",
			briefDescription = "project brief description",
			)
		s.now = datetime.datetime(2013,9,1,2,3,4)

		w = JsonSummary()
		result = w.project(s, 'myproject')
		self.assertMultiLineEqual(result,
			'{'
			'	"project" : "myproject",\n'
			'	"lastupdate" : "2013/09/01 02:03:04",\n'
			'	"clients" : [\n'
			'	]\n'
			'}'
			)
示例#10
0
	def test_project_noClients(self) :
		s = Logger("fixture")
		s.createServer()
		s.createProject("myproject")
		s.setProjectMetadata("myproject",
			description = "project description",
			briefDescription = "project brief description",
			)
		s.now = datetime.datetime(2013,9,1,2,3,4)

		w = JsonSummary()
		result = w.project(s, 'myproject')
		self.assertMultiLineEqual(result,
			'{'
			'	"project" : "myproject",\n'
			'	"lastupdate" : "2013/09/01 02:03:04",\n'
			'	"clients" : [\n'
			'	]\n'
			'}'
			)