def test_it_should_return_none_account_key(self): try: response = src.test_client().get('/v1/users') response_list = json.loads(response.data.decode('utf8')) expected_value = None real_value = response_list[0]['account_key'] nose.tools.assert_equal( expected_value, real_value, "/v1/users should have returned {} for the first account_key, but it returned {}" .format(expected_value, real_value)) except Exception as ex: print(ex) nose.tools.assert_false(True)
def test_it_should_return_the_correct_email(self): try: response = src.test_client().get('/v1/users') response_list = json.loads(response.data.decode('utf8')) expected_value = "*****@*****.**" real_value = response_list[0]['email'] nose.tools.assert_equal( expected_value, real_value, "/v1/users should have returned {} for the first email, but it returned {}" .format(expected_value, real_value)) except Exception as ex: print(ex) nose.tools.assert_false(True)
def test_it_should_return_200_when_users_exist(self): try: response = src.test_client().get('/v1/users') expected_value = 200 real_value = response.status_code nose.tools.assert_equal( expected_value, real_value, 'it should have returned {} but returned {} instead'.format( expected_value, real_value)) except Exception as ex: print(ex) nose.tools.assert_false(True)
def test_it_should_return_the_correct_number_of_users(self): try: response = src.test_client().get('/v1/users') response_list = json.loads(response.data.decode('utf8')) expected_value = len(self.response_user_list) real_value = len(response_list) nose.tools.assert_equal( expected_value, real_value, "/v1/users should have returned {} items, but it returned {}". format(expected_value, real_value)) except Exception as ex: print(ex) nose.tools.assert_false(True)