expressly/expressly-plugin-sdk-python3-core

View on GitHub
expressly/tests/models/test_field_value.py

Summary

Maintainability
A
3 hrs
Test Coverage
from unittest import TestCase
from expressly.models import FieldValue
from schematics.exceptions import ModelValidationError


class FieldValueTest(TestCase):
    def setUp(self):
        self.m = FieldValue().get_mock_object()

    def test_required(self):
        self.assertIsNotNone(self.m.field)
        self.assertIsNotNone(self.m.value)

    def test_validation(self):
        m = FieldValue()
        self.assertRaises(ModelValidationError, m.validate)

    def test_serialization(self):
        json_str = str(self.m)
        self.assertIn('"field": "%s"' % self.m.field, json_str)
        self.assertIn('"value": "%s"' % self.m.value, json_str)