def test_buildresult1(self): """project result""" br = BuildResult('test') res = br.result() self.assertTrue(len(res.result[:]) == 2) self.assertEqual(res.result[0].get('project'), 'test') self.assertEqual(res.result[0].get('repository'), 'openSUSE_Factory') self.assertEqual(res.result[0].get('arch'), 'i586') self.assertEqual(res.result[0].get('state'), 'building') self.assertTrue(len(res.result[0].status[:]) == 3) self.assertEqual(res.result[0].status[0].get('package'), 'foo') self.assertEqual(res.result[0].status[0].get('code'), 'disabled') self.assertEqual(res.result[0].status[0].details, '') self.assertEqual(res.result[0].status[1].get('package'), 'bar') self.assertEqual(res.result[0].status[1].get('code'), 'succeeded') self.assertEqual(res.result[0].status[1].details, '') self.assertEqual(res.result[0].status[2].get('package'), 'osc') self.assertEqual(res.result[0].status[2].get('code'), 'building') self.assertEqual(res.result[0].status[2].details, 'builds on host foo') # x86_64 self.assertEqual(res.result[1].get('project'), 'test') self.assertEqual(res.result[1].get('repository'), 'openSUSE_Factory') self.assertEqual(res.result[1].get('arch'), 'x86_64') self.assertEqual(res.result[1].get('state'), 'building') self.assertEqual(res.result[1].get('dirty'), 'true') self.assertTrue(len(res.result[1].status[:]) == 3) self.assertEqual(res.result[1].status[0].get('package'), 'foo') self.assertEqual(res.result[1].status[0].get('code'), 'disabled') self.assertEqual(res.result[1].status[0].details, '') self.assertEqual(res.result[1].status[1].get('package'), 'bar') self.assertEqual(res.result[1].status[1].get('code'), 'succeeded') self.assertEqual(res.result[1].status[1].details, '') self.assertEqual(res.result[1].status[2].get('package'), 'osc') self.assertEqual(res.result[1].status[2].get('code'), 'succeeded') self.assertEqual(res.result[1].status[2].details, '')
def test_buildresult5(self): """package repo arch result""" br = BuildResult('test', package='bar', repository='openSUSE_Factory', arch='x86_64') res = br.result(x='y') self.assertTrue(len(res.result[:]) == 1) self.assertEqual(res.result[0].get('project'), 'test') self.assertEqual(res.result[0].get('repository'), 'openSUSE_Factory') self.assertEqual(res.result[0].get('arch'), 'x86_64') self.assertEqual(res.result[0].get('state'), 'building') self.assertEqual(res.result[0].get('dirty'), 'true') self.assertEqual(res.result[0].status[0].get('package'), 'bar') self.assertEqual(res.result[0].status[0].get('code'), 'excluded') self.assertEqual(res.result[0].status[0].details, '') # check unknown element self.assertRaises(AttributeError, res.result[0].status[0].__getattr__, 'asdf')
def test_buildresult4(self): """package result""" br = BuildResult('test', package='bar') res = br.result() self.assertTrue(len(res.result[:]) == 2) self.assertEqual(res.result[0].get('project'), 'test') self.assertEqual(res.result[0].get('repository'), 'openSUSE_Factory') self.assertEqual(res.result[0].get('arch'), 'i586') self.assertEqual(res.result[0].get('state'), 'building') self.assertEqual(res.result[0].status[0].get('package'), 'bar') self.assertEqual(res.result[0].status[0].get('code'), 'finished') self.assertEqual(res.result[0].status[0].details, 'succeeded') # x86_64 self.assertEqual(res.result[1].get('project'), 'test') self.assertEqual(res.result[1].get('repository'), 'openSUSE_Factory') self.assertEqual(res.result[1].get('arch'), 'x86_64') self.assertEqual(res.result[1].get('state'), 'building') self.assertEqual(res.result[1].get('dirty'), 'true') self.assertEqual(res.result[1].status[0].get('package'), 'bar') self.assertEqual(res.result[1].status[0].get('code'), 'excluded') self.assertEqual(res.result[1].status[0].details, '')
def test_buildresult3(self): """project repo arch result""" br = BuildResult('test', repository='openSUSE_Factory', arch='x86_64') res = br.result() # result is the same as in test1 for arch x86_64 (small check here) self.assertTrue(len(res.result[:]) == 1)
def test_buildresult2(self): """project repo result""" br = BuildResult('test', repository='openSUSE_Factory') res = br.result() # result is the same as in test1 (so just do a small check here) self.assertTrue(len(res.result[:]) == 2)