def test_fields(self): """Assert fields are representing our model.""" fields = field_names(self.model) expected = ( 'id', 'digest_field', 'digest_with_original_field', 'hmac_field', 'hmac_with_original_field', 'email_pgp_pub_field', 'integer_pgp_pub_field', 'pgp_pub_field', 'char_pub_field', 'decimal_pgp_pub_field', 'email_pgp_sym_field', 'integer_pgp_sym_field', 'pgp_sym_field', 'char_sym_field', 'date_pgp_sym_field', 'datetime_pgp_sym_field', 'time_pgp_sym_field', 'date_pgp_pub_field', 'datetime_pgp_pub_field', 'time_pgp_pub_field', 'decimal_pgp_sym_field', 'float_pgp_pub_field', 'float_pgp_sym_field', 'fk_model', ) self.assertCountEqual(fields, expected)
def test_null(self): """Assert `NULL` values are saved.""" instance = EncryptedModel.objects.create() fields = field_names(self.model) fields.remove('id') for field in fields: with self.subTest(field=field): self.assertEqual(getattr(instance, field), None)
def test_fields(self): fields = field_names(Country) expected = { 'code', 'id', 'name', } self.assertEqual(fields, expected)
def test_fields(self): """URLRedirect has Route's fields and some specific to redirects.""" expected = ( 'id', 'route_ptr', 'target', 'permanent', ) + NODE_BASE_FIELDS fields = field_names(URLRedirect) self.assertCountEqual(fields, expected)
def test_fields(self): expected_fields = { 'id', 'user_pk', 'registration_date', 'timestamp', 'url', 'request_method', } self.assertEqual(field_names(Log), expected_fields)
def test_null(self): """Assert `NULL` values are saved.""" instance = EncryptedModel.objects.create() fields = field_names(self.model) fields.remove('id') for field in fields: with self.subTest(instance=instance, field=field): value = getattr(instance, field) self.assertEqual(value, None, msg='Field {}, Value: {}'.format( field, value))
def test_fields(self): """Check the Route model has the expected fields.""" expected = ( 'id', 'routeredirect', 'urlredirect', # Incoming foreign keys from subclasses in tests 'mockviewroute', 'urlconfroute', ) + NODE_BASE_FIELDS fields = field_names(Route) self.assertCountEqual(fields, expected)
def test_fields(self): expected = { 'id', 'body', 'question', 'created_date', # incoming relationship 'questions', 'user', 'votes', } fields = field_names(Answer) self.assertEqual(fields, expected)
def test_fields(self): """Assert fields are representing our model.""" fields = field_names(self.model) expected = ( 'id', 'digest_field', 'hmac_field', 'email_pgp_pub_field', 'integer_pgp_pub_field', 'pgp_pub_field', 'email_pgp_sym_field', 'integer_pgp_sym_field', 'pgp_sym_field', ) self.assertCountEqual(fields, expected)
def test_fields(self): expected = { 'id', 'name', 'body', 'created_date', 'accepted_answer', # incoming relationships 'answers', 'user', 'votes', } fields = field_names(Question) self.assertEqual(fields, expected)
def test_fields(self): expected = { 'id', 'email', 'last_login', 'name', 'is_superuser', 'password', 'answer_votes', 'answers', 'groups', 'logentry', 'question_votes', 'questions', 'user_permissions', } fields = field_names(User) self.assertEqual(fields, expected)
def test_field_names(): fields = utils.field_names(User) assert fields == {'id', 'email', 'name'}
def test_fields(self): expected = {'id', 'user', 'vote', 'question'} fields = field_names(QuestionVote) self.assertEqual(fields, expected)
def test_fields(self): expected = {'id', 'user', 'vote', 'answer'} fields = field_names(AnswerVote) self.assertEqual(fields, expected)