Exemplo n.º 1
0
 def test_create_defaults(self):
     request = tag_messages.CreateTagRequest(
         tag=tag_messages.Tag(name='restricted_location', color='blue'))
     with mock.patch.object(self.service, 'check_xsrf_token',
                            autospec=True) as mock_xsrf_token:
         response = self.service.create(request)
         self.assertEqual(mock_xsrf_token.call_count, 1)
         self.assertIsInstance(response, message_types.VoidMessage)
Exemplo n.º 2
0
 def test_create(self):
     request = tag_messages.CreateTagRequest(
         tag=tag_messages.Tag(name='restricted_location',
                              hidden=False,
                              color='red',
                              description='leadership circle'))
     with mock.patch.object(self.service, 'check_xsrf_token',
                            autospec=True) as mock_xsrf_token:
         response = self.service.create(request)
         self.assertEqual(mock_xsrf_token.call_count, 1)
         self.assertIsInstance(response, message_types.VoidMessage)
Exemplo n.º 3
0
 def test_create_bad_request(self):
     """Test create raises BadRequestException with required fields missing."""
     request = tag_messages.CreateTagRequest(tag=tag_messages.Tag(
         name='no_color_tag'))
     with self.assertRaises(endpoints.BadRequestException):
         self.service.create(request)
Exemplo n.º 4
0
 def test_create_prexisting_tag(self):
     request = tag_messages.CreateTagRequest(tag=tag_messages.Tag(
         name=self.test_tag.name, hidden=False, color='blue'))
     with self.assertRaises(endpoints.BadRequestException):
         self.service.create(request)
 def testCreateTagRequest(self):
     create_tag_req = tag_messages.CreateTagRequest(tag=self.tag)
     self.assert_tag(create_tag_req.tag)