<commit_before>""" Low level tests for the InvenTree API """

from rest_framework.test import APITestCase
from rest_framework import status

from django.urls import reverse

from django.contrib.auth import get_user_model


class APITests(APITestCase):
    """ Tests for the InvenTree API """

    fixtures = [
        'location',
        'stock',
        'part',
        'category',
    ]

    username = 'test_user'
    password = '<PASSWORD>'

    def setUp(self):

        # Create a user (but do not log in!)
        User = get_user_model()
        User.objects.create_user(self.username, '<EMAIL>', self.password)

    def test_info_view(self):
        """
        Test that we can read the 'info-view' endpoint.
        """

        url = reverse('api-inventree-info')

        response = self.client.get(url, format='json')

        print(response)
        print(dir(response))
<commit_msg>Test API info endpoint<commit_after>""" Low level tests for the InvenTree API """

from rest_framework.test import APITestCase
from rest_framework import status

from django.urls import reverse

from django.contrib.auth import get_user_model


class APITests(APITestCase):
    """ Tests for the InvenTree API """

    fixtures = [
        'location',
        'stock',
        'part',
        'category',
    ]

    username = 'test_user'
    password = '<PASSWORD>'

    def setUp(self):

        # Create a user (but do not log in!)
        User = get_user_model()
        User.objects.create_user(self.username, '<EMAIL>', self.password)

    def test_info_view(self):
        """
        Test that we can read the 'info-view' endpoint.
        """

        url = reverse('api-inventree-info')

        response = self.client.get(url, format='json')

        data = response.json()
        self.assertIn('server', data)
        self.assertIn('version', data)
        self.assertIn('instance', data)

        self.assertEquals('InvenTree', data['server'])

{'fraction_non_alphanumeric': 0.11770726714431934, 'fraction_numerical': 0.0, 'mean_word_length': 2.5610200364298725, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4987514', 'n_tokens_mistral': 584, 'n_tokens_neox': 570, 'n_words': 155}