"""Unit tests for user model layer.""" from analytics.models import user def test_create_user_label(): """Test user creation.""" for user_type in ('vendor', 'VENDOR'): response = user.create_user(1084874, user_type) assert response assert response.message.user_type == 'L' def test_create_user_subaccount(): """Test user creation.""" for user_type in ('subaccount', 'SUBACCOUNT'): response = user.create_user(1084874, user_type) assert response assert response.message.user_type == 'S' def test_create_user_with_wrong_type(): """Test user creation with wrong type.""" response = user.create_user(209872, 'random') assert response.status == 400 assert response.errors.get( 'user_type').find('account type is not recognized') > 0