test_rival_regions_wrapper.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. """Wrapper test"""
  2. import pytest
  3. from rival_regions_wrapper.api_wrapper import Profile
  4. @pytest.fixture
  5. def profile_keys():
  6. """Standard key from profile"""
  7. return ['profile_id', 'name', 'level', 'level_percentage', 'strenght', 'education', 'endurance']
  8. @pytest.mark.vcr()
  9. def test_profile_info(profile_keys):
  10. """Test an API call to get client info"""
  11. profile_instance = Profile(192852686)
  12. response = profile_instance.info()
  13. print(response)
  14. assert isinstance(response, dict), "The response should be a dict"
  15. assert response['profile_id'] == 192852686, "The ID should be in the response"
  16. assert set(profile_keys).issubset(response.keys()), "All keys should be in the response"
  17. assert isinstance(response['name'], str), "Name should be a string"
  18. assert isinstance(response['level'], int), "level should be a int"
  19. assert isinstance(response['level_percentage'], int), "level_percentage should be a int"
  20. assert isinstance(response['strenght'], int), "strenght should be a int"
  21. assert isinstance(response['education'], int), "education should be a int"
  22. assert isinstance(response['endurance'], int), "endurance should be a int"
  23. @pytest.fixture
  24. def storage_keys():
  25. """Standard keys for storage"""
  26. return [
  27. 'profile_id', 'oil', 'ore', 'uranium', 'diamonds', 'liquid_oxygen', 'rivalium',
  28. 'antirad', 'energy_drink', 'spacerockets', 'lss', 'tanks', 'aircrafts',
  29. 'missiles', 'bombers', 'battleships', 'laser_drones', 'moon_tanks', 'space_stations'
  30. ]