test_rival_regions_wrapper.py 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. """Wrapper test"""
  2. import pytest
  3. from rival_regions_wrapper.api_wrapper import Profile, Storage
  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. assert isinstance(response, dict), "The response should be a dict"
  14. assert response['profile_id'] == 192852686, "The ID should be in the response"
  15. assert set(profile_keys).issubset(response.keys()), "All keys should be in the response"
  16. assert isinstance(response['name'], str), "Name should be a string"
  17. assert isinstance(response['level'], int), "level should be a int"
  18. assert isinstance(response['level_percentage'], int), "level_percentage should be a int"
  19. assert isinstance(response['strenght'], int), "strenght should be a int"
  20. assert isinstance(response['education'], int), "education should be a int"
  21. assert isinstance(response['endurance'], int), "endurance should be a int"
  22. @pytest.fixture
  23. def storage_keys():
  24. """Standard keys for storage"""
  25. return [
  26. 'oil', 'ore', 'uranium', 'diamonds', 'liquid_oxygen',
  27. 'helium-3', 'rivalium', 'antirad', 'energy_drink',
  28. 'spacerockets', 'lss', 'tanks', 'aircrafts', 'missiles',
  29. 'bombers', 'battleships', 'laser_drones', 'moon_tanks', 'space_stations',
  30. 'oil_max', 'ore_max', 'uranium_max', 'diamonds_max', 'liquid_oxygen_max',
  31. 'helium-3_max', 'rivalium_max', 'antirad_max', 'energy_drink_max',
  32. 'spacerockets_max', 'lss_max', 'tanks_max', 'aircrafts_max', 'missiles_max',
  33. 'bombers_max', 'battleships_max', 'laser_drones_max', 'moon_tanks_max', 'space_stations'
  34. ]
  35. @pytest.mark.vcr()
  36. def test_storage_info(storage_keys):
  37. """Test an API call to get storage info"""
  38. response = Storage.info()
  39. assert isinstance(response, dict), "The response should be a dict"
  40. assert set(storage_keys).issubset(response.keys()), "All keys should be in the response"