88from unittest import skip
99import time
1010
11- class TestWatchlistAPI (unittest .TestCase ):
11+ class TestWatchlistsAPI (unittest .TestCase ):
1212 def setUp (self ):
1313 try :
1414 self .client = blockscore .Client ({'api_key' : os .environ ['BLOCKSCORE_API' ]})
@@ -39,7 +39,7 @@ def setUp(self):
3939 }
4040
4141 def test_create_body (self ):
42- body = self .client .watchlist ._create_body (** self .test_identity )
42+ body = self .client .watchlists ._create_body (** self .test_identity )
4343 self .assertDictEqual ({
4444 'ssn' : self .test_identity ['identification' ]['ssn' ],
4545 'date_of_birth' : self .test_identity ['date_of_birth' ],
@@ -57,57 +57,57 @@ def test_create_body(self):
5757 }, body )
5858
5959 def test_create_candidate (self ):
60- candidate = self .client .watchlist .create (** self .test_identity )
61- expected_body = self .client .watchlist ._create_body (** self .test_identity )
60+ candidate = self .client .watchlists .create (** self .test_identity )
61+ expected_body = self .client .watchlists ._create_body (** self .test_identity )
6262 self .assertDictContainsSubset (expected_body , candidate .body )
6363
6464 def test_edit_candidate (self ):
65- candidate_id = self .client .watchlist .create (** self .test_identity ).body ['id' ]
66- candidate = self .client .watchlist .edit (candidate_id , date_of_birth = '1980-01-02' )
65+ candidate_id = self .client .watchlists .create (** self .test_identity ).body ['id' ]
66+ candidate = self .client .watchlists .edit (candidate_id , date_of_birth = '1980-01-02' )
6767 self .test_identity ['date_of_birth' ] = '1980-01-02'
68- expected_body = self .client .watchlist ._create_body (** self .test_identity )
68+ expected_body = self .client .watchlists ._create_body (** self .test_identity )
6969 expected_body ['id' ] = candidate_id
7070 self .assertDictContainsSubset (expected_body , candidate .body )
7171
7272 def test_retrieve_candidate (self ):
73- candidate_id = self .client .watchlist .create (** self .test_identity ).body ['id' ]
74- candidate = self .client .watchlist .retrieve (candidate_id )
75- expected_body = self .client .watchlist ._create_body (** self .test_identity )
73+ candidate_id = self .client .watchlists .create (** self .test_identity ).body ['id' ]
74+ candidate = self .client .watchlists .retrieve (candidate_id )
75+ expected_body = self .client .watchlists ._create_body (** self .test_identity )
7676 expected_body ['id' ] = candidate_id
7777 self .assertDictContainsSubset (expected_body , candidate .body )
7878
7979 def test_delete_candidate (self ):
80- candidate_id = self .client .watchlist .create (** self .test_identity ).body ['id' ]
81- candidate = self .client .watchlist .delete (candidate_id )
82- expected_body = self .client .watchlist ._create_body (** self .test_identity )
80+ candidate_id = self .client .watchlists .create (** self .test_identity ).body ['id' ]
81+ candidate = self .client .watchlists .delete (candidate_id )
82+ expected_body = self .client .watchlists ._create_body (** self .test_identity )
8383 expected_body ['id' ] = candidate_id
8484 expected_body ['deleted' ] = True
8585 self .assertDictContainsSubset (expected_body , candidate .body )
8686
8787 @skip ('These tests do not pass consistently because of eventual consistency of candidate list' )
8888 def test_list_candidates_with_params (self ):
89- candidate = self .client .watchlist .create ()
90- candidate_list = self .client .watchlist .list (count = 1 )
89+ candidate = self .client .watchlists .create ()
90+ candidate_list = self .client .watchlists .list (count = 1 )
9191 self .assertListEqual ([candidate .body ], candidate_list .body )
92- self .client .watchlist .create ()
93- candidate_list = self .client .watchlist .list (count = 1 , offset = 1 )
92+ self .client .watchlists .create ()
93+ candidate_list = self .client .watchlists .list (count = 1 , offset = 1 )
9494 self .assertListEqual ([candidate .body ], candidate_list .body )
9595
9696 #@skip('These tests do not pass consistently because of eventual consistency of candidate list')
9797 def test_list_candidates_all (self ):
98- candidate = self .client .watchlist .create (** self .test_identity )
99- expected_body = self .client .watchlist ._create_body (** self .test_identity )
98+ candidate = self .client .watchlists .create (** self .test_identity )
99+ expected_body = self .client .watchlists ._create_body (** self .test_identity )
100100 candidate_id = candidate .body ['id' ]
101101 time .sleep (5 )
102- candidate_list = self .client .watchlist .list ()
102+ candidate_list = self .client .watchlists .list ()
103103 match = {}
104104 for c in candidate_list .body ['data' ]:
105105 if c [u'id' ] == candidate_id :
106106 match = c
107107 self .assertDictContainsSubset (expected_body , match )
108108
109109 def test_search (self ):
110- candidate_id = self .client .watchlist .create ().body ['id' ]
111- response = self .client .watchlist .search (candidate_id )
110+ candidate_id = self .client .watchlists .create ().body ['id' ]
111+ response = self .client .watchlists .search (candidate_id )
112112 self .assertIn ('searched_lists' , response .body )
113113 self .assertIn ('matches' , response .body )
0 commit comments