diff --git a/.gitignore b/.gitignore index c8e6e201..bdc2955a 100755 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ node_modules .vscode *.env Resources/nginx/ssl/* -!Resources/nginx/ssl/*.sample.* \ No newline at end of file +!Resources/nginx/ssl/*.sample.* +.idea* \ No newline at end of file diff --git a/pokemon_v2/serializers.py b/pokemon_v2/serializers.py index fe7d73ef..8fa6ad84 100644 --- a/pokemon_v2/serializers.py +++ b/pokemon_v2/serializers.py @@ -487,7 +487,7 @@ class CharacteristicDetailSerializer(serializers.ModelSerializer): mod = obj.gene_mod_5 values = [] - while mod <= 30: + while mod <= 31: values.append(mod) mod += 5 diff --git a/pokemon_v2/tests.py b/pokemon_v2/tests.py index 6cd2271d..ce947134 100644 --- a/pokemon_v2/tests.py +++ b/pokemon_v2/tests.py @@ -4337,6 +4337,21 @@ class APITests(APIData, APITestCase): "{}{}/stat/{}/".format(TEST_HOST, API_V2, characteristic.stat.pk), ) + def test_characteristic_values(self): + l = [] + # check for all 5 possible values of gene_modulo + for modulo in range(5): + characteristic = self.setup_characteristic_data(gene_mod_5=modulo) + # note that 'possible_values' is computed solely from gene_modulo + # thus it is fine that our test characteristics are indexed 1-5 + result = self.client.get( + "{}/characteristic/{}/".format(API_V2, characteristic.pk)) + for i in range(len(result.data['possible_values'])): + self.assertEqual( + result.data['possible_values'][i], characteristic.gene_mod_5 + i * 5 + ) + + # Nature Tests def test_nature_api(self):