<s> from uuid import uuid4 <EOL> from changes . constants import Result , Status <EOL> from changes . testutils import APITestCase <EOL> class ProjectTestIndexTest ( APITestCase ) : <EOL> def test_simple ( self ) : <EOL> fake_project_id = uuid4 ( ) <EOL> project = self . create_project ( ) <EOL> build = self . create_build ( project ) <EOL> self . create_job ( build ) <EOL> project2 = self . create_project ( ) <EOL> build = self . create_build ( project2 , status = Status . finished , result = Result . passed ) <EOL> job = self . create_job ( build ) <EOL> test = self . create_test ( job = job , name = '<STR_LIT>' , duration = <NUM_LIT:50> ) <EOL> path = '<STR_LIT>' . format ( fake_project_id . hex ) <EOL> resp = self . client . get ( path ) <EOL> assert resp . status_code == <NUM_LIT> <EOL> path = '<STR_LIT>' . format ( project2 . id . hex ) <EOL> resp = self . client . get ( path ) <EOL> assert resp . status_code == <NUM_LIT:200> <EOL> data = self . unserialize ( resp ) <EOL> assert len ( data ) == <NUM_LIT:1> <EOL> assert data [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == test . name_sha <EOL> assert data [ <NUM_LIT:0> ] [ '<STR_LIT>' ] [ '<STR_LIT:id>' ] == project2 . id . hex <EOL> path = '<STR_LIT>' . format ( project2 . id . hex ) <EOL> resp = self . client . get ( path ) <EOL> assert resp . status_code == <NUM_LIT:200> <EOL> data = self . unserialize ( resp ) <EOL> assert len ( data ) == <NUM_LIT:1> <EOL> assert data [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == test . name_sha <EOL> assert data [ <NUM_LIT:0> ] [ '<STR_LIT>' ] [ '<STR_LIT:id>' ] == project2 . id . hex <EOL> path = '<STR_LIT>' . format ( project2 . id . hex ) <EOL> resp = self . client . get ( path ) <EOL> assert resp . status_code == <NUM_LIT:200> <EOL> data = self . unserialize ( resp ) <EOL> assert len ( data ) == <NUM_LIT:1> <EOL> assert data [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == test . name_sha <EOL> assert data [ <NUM_LIT:0> ] [ '<STR_LIT>' ] [ '<STR_LIT:id>' ] == project2 . id . hex <EOL> path = '<STR_LIT>' . format ( project2 . id . hex ) <EOL> resp = self . client . get ( path ) <EOL> assert resp . status_code == <NUM_LIT:200> <EOL> data = self . unserialize ( resp ) <EOL> assert len ( data ) == <NUM_LIT:0> <EOL> path = '<STR_LIT>' . format ( project2 . id . hex ) <EOL> resp = self . client . get ( path ) <EOL> assert resp . status_code == <NUM_LIT:200> <EOL> data = self . unserialize ( resp ) <EOL> assert len ( data ) == <NUM_LIT:1> <EOL> assert data [ <NUM_LIT:0> ] [ '<STR_LIT>' ] == test . name_sha <EOL> assert data [ <NUM_LIT:0> ] [ '<STR_LIT>' ] [ '<STR_LIT:id>' ] == project2 . id . hex <EOL> path = '<STR_LIT>' . format ( project2 . id . hex ) <EOL> resp = self . client . get ( path ) <EOL> assert resp . status_code == <NUM_LIT:200> <EOL> data = self . unserialize ( resp ) <EOL> assert len ( data ) == <NUM_LIT:0> </s>
